I have a list of objects that are keyed off or identified uniquely by one of their properties say “ID”. I need to group all the objects of different ID’s that will have rest of properties the same.
Example: Obj has properties “ID”, “E1”, “E2” , “E3”. Note these are all properties of the Obj.
I know ID’s are different for all List of Obj’s, but would like to group if E1,E2 and E3 are same for different Obj’s. So I would have array of Obj’s that have same E1,E2,E3 but different ID’s.
What’s the easiest way of handling this in C#, any ideas?
Well, something like this would work with LINQ:
That will give you a sequence of groupings you can iterate over. For example: