Filtering refers to the process of narrowing down the results of your query base on a condition. Let's take a look at both syntaxes of LINQ using filtering as an example:
var query = from person in context.People where person.HeightInFeet >= 6 select person; var methodQuery = context.People.Where(p => p.HeightInFeet >= 6);
The purpose behind the query is to retrieve the people who are at least
6 feet tall. This means that we have a specific condition that all the data in our results must match. Both lines of code answer this question. The first line uses query syntax. There are distinct parallels to the SQL query syntax. We have the
select blocks of code. Their order is different from SQL, but they certainly ...