MyObject()
{
String dept;
List<int> id;
Object obj;
}
Using LINQ, how can I return a list of the above objects organized as follows:
Group all of the obj objects by [ department and EQUAL id list ]. The list being considered equal if it contains the same numbers, not necessarily the same order(a set).
GroupByhas an overload that accepts a customIEqualityComparer<MyObject>. Write one that regards two objects as equal whendeptis equal andidis set-equal, and pass it as an argument.A convenient way to implement set equality is to write
although this will end up being inefficient and probably not the best idea if there are lots of comparisons to make.