From the course: Visual Basic Essential Training

Unlock this course with a free trial

Join today to access over 24,500 courses taught by industry experts.

Use lambda expressions with LINQ

Use lambda expressions with LINQ - Visual Basic Tutorial

From the course: Visual Basic Essential Training

Use lambda expressions with LINQ

- [Instructor] Many of the LINQ query operators need information from us to perform the query. We need to provide a delegate to the operator. It's common to use Lambda expressions for this. In this video, we're looking at two query operators, the Where operator, which we use for filtering, and the OrderBy operator, which we use to change the order of the items in the list. Let's start by looking at the Where clause. So what am I doing up here? I am using one of the standard methods on the enumerable class called .Range. That'll generate a range of integers from one to 300, and then I use that as the source for the query. I call .Where, this is one of the extension methods. And then I am using a Lambda expression here, and the function is in line. We've seen this before, but to review, we used a function keyword and then the parameters, in this case, this will represent the integer that's in the list of integers. Choosing a name for this variable is up to you. You'll find it common in…

Contents