How to Use the Where Method
Explore using the LINQ Where method to filter collections in C#. Learn how to replace loops with concise, expressive code that picks elements matching specific criteria using lambda expressions.
We'll cover the following...
We'll cover the following...
Now, let’s rewrite our example to find our favorite movies. We’ve decided a movie is a favorite if it has a rating greater than 4.5 points.
How to filter a collection with Where
To start using LINQ methods, let’s add the statement using System.Linq to our using declarations at the top of our file. ...