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 - 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
-
-
-
-
-
-
What sources are valid for LINQ to Objects1m 21s
-
Basic LINQ query operators2m 3s
-
Write LINQ query expressions1m 49s
-
Connect to a database2m 9s
-
Query the database with SQL1m 37s
-
Use the DataContext1m 47s
-
Query the database with a LINQ expression2m 34s
-
Configure an XML file as a data source2m 35s
-
Query the XML file1m 8s
-
Filter by attributes54s
-
-
-
-
-
-
-