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

Where clause on attribute value - .NET Tutorial

From the course: .NET Essentials: LINQ for XML

Start my 1-month free trial

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