title | description | keywords | author | manager | ms.author | ms.date | ms.topic | ms.prod | ms.technology | ms.devlang | ms.assetid |
---|---|---|---|---|---|---|---|---|---|---|---|
Create a nested group |
How to create a nested group. |
.NET, .NET Core, C# |
stevehoag |
wpickett |
wiwagn |
12/1/2016 |
article |
.net-core |
.net-core-technologies |
dotnet |
e9f00708-362e-4d13-98c5-d77549347ba0 |
The following example shows how to create nested groups in a LINQ query expression. Each group that is created according to student year or grade level is then further subdivided into groups based on the individuals' names.
Note
This example contains references to objects that are defined in the sample code in Query a collection of objects.
[!code-cscsProgGuideLINQ#24]
Note that three nested foreach
loops are required to iterate over the inner elements of a nested group.