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.
Query the XML file - LINQ Tutorial
From the course: LINQPad Essential Training
Query the XML file
- [Narrator] In this query, I want to retrieve the value for this element. So let's see what we know about this. It's under the root node, it's in all the elements. There's 12 of these robot elements. And so what I want to do is drill down in, and pull out the data from this child element. So I'm doing that, is I'm using a query expression here. And I'm saying from all elements in the elements, then select out all elements dot element. So see how I'm drilling down one level deep. So I'm starting here at robot, and then going to its child elements, and finding the one named, robot name. Now, when I dump this, I get 12 rows, and I'm getting, almost getting the data I want. Unfortunately, at this moment, I still have the beginning and end tags, for the XML data. What I really want is just the robot names. So, the way you solve that is to go to the element, and say, I want the value. I don't want the XML, I want the…
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)
-
-
-
-
-
-