I have a class like this
public class ValueGroup { public string Name { get; set; } public List<Value> Values { get; set; } } public class Value { public int RealValue { get; set; } public bool IsFavourite { get; set; } And a list of some items
var valueList = new List<ValueGroup> { new ValueGroup { Name = "1st Group", Values = new List<Value> { new Value { RealValue = 6, IsFavourite = false }, new Value { RealValue = 2, IsFavourite = true }, new Value { RealValue = 4, IsFavourite = false } } }, new ValueGroup { Name = "2nd Group", Values = new List<Value> { new Value { RealValue = 7, IsFavourite = false }, new Value { RealValue = 3, IsFavourite = true }, new Value { RealValue = 8, IsFavourite = true } } }, new ValueGroup { Name = "3rd Group", Values = new List<Value> { new Value { RealValue = 9, IsFavourite = false }, new Value { RealValue = 1, IsFavourite = true }, new Value { RealValue = 5, IsFavourite = false } } } } So, now I would like to select the value group, which has the highest RealValue paired with an IsFavourit == true in its nested ValueList. So in this case, I want to select the 2nd group (the 3rd one has a bigger value, but this is not an isFavourite). Is there a chance to realize this with LINQ? Thanks for comments!