Group by

Nov 9, 2009 at 6:58 AM

how to use group by in collection.runselect();

 

help

 

thanks

Coordinator
Nov 9, 2009 at 4:58 PM

There is no group by functionality in the RunSelect static method.

Nov 9, 2009 at 5:46 PM

do u have sample how to use the distinct?

Coordinator
Nov 9, 2009 at 7:45 PM

Use the GetDistinct static method. The first parameter is the field you are checking for distinctness and the second paramter is the where clause. The statement below will find all distinct first names for customers where the customer id is less than 100.

IEnumerable<string> idList = CustomerCollection.GetDistinct(x => x.FirstName, x => x.CustomerId < 100);

If you are trying to find distinct values in a loaded, in-memory collection, just use standard LINQ.