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.
Where clause on attribute value - .NET Tutorial
From the course: .NET Essentials: LINQ for XML
Where clause on attribute value
- [Instructor] Link for objects contains a lot of query operators. These are implemented as extension methods and most of them can be used in query expressions. And one of the most popular of these is the Where operator where you use it to filter the results. So that's what I'm doing here in this query expression. Most of the examples I'm showing in this chapter use query expressions but everything I'm showing you here can also be done using the extension methods. So, I started out by getting all the cards. That's what I'm doing here on this first line, getting all the cards in the XML file. And then I use the where keyword and here I have to provide a expression that evaluates to true or false. And that's used by the query to determine what belongs in the output. So I'm looking for an attribute on the card, the attribute's called card name and the value of that card name has to be mingled. Once I get that, then I'm…
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)
-
-