From the course: LINQPad Essential Training

Unlock this course with a free trial

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

Write LINQ query expressions

Write LINQ query expressions - LINQ Tutorial

From the course: LINQPad Essential Training

Write LINQ query expressions

- [Instructor] Next, we look at the LINQ Query Expression Syntax. This syntax is often the first one you see demoed, in LINQ examples. It's designed to look similar to the CQL query syntax. You can see it here on line 11 through 14. So, I declare a variable here, that will hold the potential query. And then on line 16, I'll run the query. I then say from X in colors, X in this case is a variable that I use throughout the rest of the query, and colors in this case is the same data source we've seen before. It's a list of strings, and then I'm using where, order by, and select keywords to filter by strings that are greater than five characters, order in alphabetical order, and then select that the results. You want to run this, I get five items, that are in alphabetical order, and you notice that this (indistinct) is greater than five. That's the query expression syntax. Microsoft spent a lot of time making…

Contents