OrElse
OrElse

Reputation: 9989

Simple LINQ to XML query

This one is my simple XML

 Dim Xml = <BODY ID="1">
   <HEAD1>
    <Eyes type="S" l="1" f="1"></Eyes>
   </HEAD1>
   <HEAD2>
    <Eyes type="S" l="1" f="1"></Eyes>
   </HEAD2>
   </BODY>

How can i write a LINQ query to return as result the following?

HEAD1
HEAD2

Upvotes: 0

Views: 140

Answers (1)

Lasse Espeholt
Lasse Espeholt

Reputation: 17792

I can give you the answer in C# (and try to convert it to VB.Net)

var result = from element in xml.Root.Elements()
             select element.Name;

this may be VB.Net code:

Dim result = From element In xml.Root.Elements Select element.Name

Upvotes: 1

Related Questions