You need to query data that is stored in a collection or array, but you need group the data in some hierarchical format.
Create a standard LINQ query, such as the ones described in the previous recipes, and use the Group By clause to specify how the data should be organized.
How It Works
The Group By clause is used to organize the data returned from a query in a hierarchical format, meaning that data is returned as groups of elements or even groups of grouped elements. The format for the first portion of the clause is Group fields By key fields, where fields is a list of fields that will be included with the grouped data and key fields represents how the data is actually grouped. If no fields are supplied, ...