CLinq GroupBy(...) support

Feb 25, 2010 at 8:09 PM

Thanks for creating this library; it has been very useful.

I have some feedback regarding your support of the GroupBy method. We have some tricky grouping logic that we would like to implement, and the most direct way to do this was to actually implement a custom IEqualityComparer<T> for our data type.

Our LINQ query looked like the following then (data is a ContinuousCollection<T>):

var query = data.
            GroupBy(o => o, o => o, new MyDataGroupingComparer()).
            Select((grp, key) => new DataGroup() {ListId = grp.Key.ListId, Data = grp});

The query itself executed fine but binding it to WPF did not. I think this is because the resulting query type is:

System.Linq.Enumerable+<SelectIterator>d__7<System.Linq.IGrouping<Data,Data>,DataGroup>

However, if the group by is done using the linq keywords, the resulting query type is:

ContinuousLinq.SelectReadOnlyContinuousCollection<ContinuousLinq.Collections.GroupedReadOnlyContinuousCollection<System.Nullable<System.Int32>,Data>,DataGroup>

In other words, the GroupBy(...) syntax did not produce a collection that implements INotifyCollectionChanged. Is this kind of syntax not supported?

We were able to get around this using some other techniques, but I'd appreciate any feedback on this.

Thanks
- Szymon