I have a collection of Component and these collections have a collection of Pax:
public class Component
{
public IEnumerable<Pax> Paxes { get; set; }
}
public class Pax
{
public int Number { get; set; }
public int Room { get; set; }
}
I would like to group my Component collection (which is an IEnumerable<Component>) by the list of passenger.
var groups = components.GroupBy(c => c.Paxes);
Of course, those groups are not expected. Paxes repeated in components have not the same object reference, so I have to compare their properties in the group expression and this is where I'm stuck.