Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

linq group by

var results = persons.GroupBy(
    p => p.PersonId, 
    p => p.car,
    (key, g) => new { PersonId = key, Cars = g.ToList() });
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #linq #group
ADD COMMENT
Topic
Name
6+7 =