diff --git a/docs/csharp/linq/how-to-query-collections.md b/docs/csharp/linq/how-to-query-collections.md index 3d661a92524e3..67135645651ea 100644 --- a/docs/csharp/linq/how-to-query-collections.md +++ b/docs/csharp/linq/how-to-query-collections.md @@ -47,6 +47,8 @@ The second, *scores.csv*, contains student IDs in the first column, followed by The following example shows how to use a named record `Student` to store merged data from two in-memory collections of strings that simulate spreadsheet data in .csv format. The ID is used as the key to map students to their scores. +:::code language="csharp" source="./snippets/HowToCollections/Program.cs" id="StudentDefinition"::: + :::code language="csharp" source="./snippets/HowToCollections/Program.cs" id="PopulateCollection"::: In the [select](../language-reference/keywords/select-clause.md) clause, each new `Student` object is initialized from the data in the two sources. diff --git a/docs/csharp/linq/snippets/HowToCollections/Program.cs b/docs/csharp/linq/snippets/HowToCollections/Program.cs index 0e7562518381f..06c64e5396fa6 100644 --- a/docs/csharp/linq/snippets/HowToCollections/Program.cs +++ b/docs/csharp/linq/snippets/HowToCollections/Program.cs @@ -270,4 +270,7 @@ where student.ExamScores[0] > 95 Console.WriteLine(s.LastName + ": " + s.ExamScores[0]); // } -public record Student(string FirstName, string LastName, int[] ExamScores, int ID=0); + +// +public record Student(string FirstName, string LastName, int[] ExamScores, int ID = 0); +//