Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

groupby in linq

        //Method Syntax

        List<Result> results2 = persons
            .GroupBy(p => p.PersonId, 
                     (k, c) => new Result()
                             {
                                 PersonId = k,
                                 Cars = c.Select(cs => cs.car).ToList()
                             }
                    ).ToList();

    
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #groupby #linq
ADD COMMENT
Topic
Name
9+1 =