Using LINQ to group a list of objects

The Solution to Using LINQ to group a list of objects is


var groupedCustomerList = CustomerList.GroupBy(u => u.GroupID)
                                      .Select(grp =>new { GroupID =grp.Key, CustomerList = grp.ToList()})
                                      .ToList();

~ Answered on 2013-09-02 02:48:59


Most Viewed Questions: