Web developer can modify the where clause in LINQ statement to filter the results and to include only those that match a specific condition. The next code shows how to find clients who have a last name that starts with a specific letter:

C# 8.0 and .NET Core 3.0 – Modern Cross-Platform Development: Build applications with C#, .NET Core, Entity Framework Core, ASP.NET Core, and ML.NET using Visual Studio Code, 4th Edition
ASP.NET Core 3 and Angular 9: Full stack web development with .NET Core 3.1 and Angular 9, 3rd Edition
C# in Depth, 4th Edition

Dim matches = From client In clients _

Where client.LastName.StartsWith(“D”) _

Select client

 

Web developer can combine multiple conditional expressions with the And and Or operators, and he/she can use relational operators (such as <, <=, >, and >=) in conjunction with hard-coded values or other variables. For example, Web developer could create a query like this to filter out products greater than a certain price threshold:

 

Dim matches = From product In products _

Where product.UnitsInStocks > 0 And product.UnitPrice > 75.0 _

Select product