From the course: .NET Essentials: LINQ for Databases

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Basic concepts of LINQ

Basic concepts of LINQ - .NET Tutorial

From the course: .NET Essentials: LINQ for Databases

Start my 1-month free trial

Basic concepts of LINQ

- [Instructor] A central concept of LINQ is the idea of query operators. Think of these as to query action you want to perform. They are implemented as extension methods. You call the extension method and it performs the operation on the data. One obvious way to call the extension method, looks like this on line six. So I have some data source here. I call .where, that's the extension method, and since this is a filter function, I need to pass a predicate expression as a parameter. Now when I invoke this method, I'll get the filter results. There is another syntax available. It's the query expression syntax. This is also called the query syntax in some of the Microsoft documentation. The syntax is shown here on line 10 and it looks similar to SQL syntax. So we start with the from keyword and we end with the select. We specify the source here in the body of the expression. Instead of using a where method call like we're…

Contents