From the course: .NET Essentials: LINQ for XML
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Choose output order with OrderBy - .NET Tutorial
From the course: .NET Essentials: LINQ for XML
Choose output order with OrderBy
- [Instructor] Sorting the query results is another popular action. In the LINQ world, that is done with the orderby keyword, or the orderby extension method. Here I am sorting by this Parsed catalog value. The syntax is orderby, and then the value you want to sort on. So you can see that it's going from lowest to highest on the catalog price. Of course, I can sort on other criteria. Let's take bidParsed, and orderby on that one. Now we're going from lowest to highest on the bid price. There's also the descending keyword. I put that here, and it'll reverse this order like that.
Contents
-
-
-
-
-
(Locked)
Use Query syntax to work with elements2m 46s
-
(Locked)
Attribute query1m 27s
-
(Locked)
Select data into a new anonymous type1m 47s
-
(Locked)
Where clause on attribute value1m 53s
-
(Locked)
Where clause with compare2m 11s
-
(Locked)
Aggregate queries2m 1s
-
(Locked)
Choose output order with OrderBy42s
-
(Locked)
Query for empty elements and blank values3m 21s
-
(Locked)
Group by3m 26s
-
(Locked)
Challenge: Create custom string output1m 46s
-
(Locked)
Solution: Create custom string output1m 14s
-
(Locked)
Challenge: Filter results to show elements with no content47s
-
(Locked)
Solution: Filter results to show elements with no content55s
-
(Locked)
Challenge: Filter results to show invalid values1m 39s
-
(Locked)
Solution: Filter results to show invalid values1m 53s
-
(Locked)
-
-