From the course: LINQPad Essential Training
Unlock this course with a free trial
Join today to access over 22,600 courses taught by industry experts.
Filter by attributes - LINQ Tutorial
From the course: LINQPad Essential Training
Filter by attributes
- [instructor] For this query, I want to get the value that's associated with this attribute. So instead of getting this element value, I want to get this attribute value. So the code is nearly identical to what we saw in the last example. I started out by saying from all elements and XML tree elements. So this gets me all 12 of the child elements. And then I do another from here, or I say, get all the attributes that are part of this elements. I mean, getting all the attributes and then I'm selecting out the attributes. So now when I run this, I get the attribute value, blue, blue, blue, and so on. And I also get the attribute name here. So just like in the last query, I don't want to see that. I want to see the value only. So I'll type in .value and now re-execute, and now I'm getting the values from all of the attributes.
Contents
-
-
-
-
-
-
(Locked)
What sources are valid for LINQ to Objects1m 21s
-
(Locked)
Basic LINQ query operators2m 3s
-
(Locked)
Write LINQ query expressions1m 49s
-
(Locked)
Connect to a database2m 9s
-
(Locked)
Query the database with SQL1m 37s
-
Use the DataContext1m 47s
-
(Locked)
Query the database with a LINQ expression2m 34s
-
(Locked)
Configure an XML file as a data source2m 35s
-
(Locked)
Query the XML file1m 8s
-
(Locked)
Filter by attributes54s
-
(Locked)
-
-
-
-
-
-