title | description | keywords | author | manager | ms.author | ms.date | ms.topic | ms.prod | ms.technology | ms.devlang | ms.assetid |
---|---|---|---|---|---|---|---|---|---|---|---|
Query a collection of objects |
How query collections. |
.NET, .NET Core, C# |
stevehoag |
wpickett |
wiwagn |
11/30/2016 |
article |
.net-core |
.net-core-technologies |
dotnet |
87a76f8a-0b58-4791-90ea-2fe0a30416c9 |
This example shows how to perform a simple query over a list of Student
objects. Each Student
object contains some basic information about the student, and a list that represents the student's scores on four examinations.
This application serves as the framework for many other examples in this section that use the same students
data source.
The following query returns the students who received a score of 90 or greater on their first exam.
[!code-cscsProgGuideLINQ#15]
This query is intentionally simple to enable you to experiment. For example, you can try more conditions in the where
clause, or use an orderby
clause to sort the results.