From the course: .NET Essentials: LINQ for XML
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Aggregate queries - .NET Tutorial
From the course: .NET Essentials: LINQ for XML
Aggregate queries
- [Instructor] Link has a number of aggregate query functions that allow us to perform aggregate operations on the results of a query. Typically, this is done after you've generated your query expression and your run your query expression and then you run the aggregate on those results. So in my case, you see here on this part of the code, I'm declaring my query expression. This is the same one we've seen before. It's all the bid price is greater than 12. And then once I have that query, that storage here in this variable, that's my potential query. And then I call the aggregate function on this variable. You'll see what I mean in a minute. So let's select everything, run this. There's five items. Now let's say I wanted to total up the bid prices, I have to pick one of these values, one of these properties. It doesn't make sense to try to do an aggregate saying average value or a sum on card name. No, we won't do…
Contents
-
-
-
-
-
Use Query syntax to work with elements2m 46s
-
Attribute query1m 27s
-
Select data into a new anonymous type1m 47s
-
Where clause on attribute value1m 53s
-
Where clause with compare2m 11s
-
Aggregate queries2m 1s
-
Choose output order with OrderBy42s
-
Query for empty elements and blank values3m 21s
-
Group by3m 26s
-
Challenge: Create custom string output1m 46s
-
Solution: Create custom string output1m 14s
-
Challenge: Filter results to show elements with no content47s
-
Solution: Filter results to show elements with no content55s
-
Challenge: Filter results to show invalid values1m 39s
-
Solution: Filter results to show invalid values1m 53s
-
-
-