Passing to curly brackets with value to XContainer.Descendants() does what?

163 views Asked by At

I don't see an explanation for using curly brackets in: https://msdn.microsoft.com/en-us/library/bb353813(v=vs.110).aspx

I noticed in an exam: feed.Descendants("{urn:CFI}Flight").Concat(feed.Descendants(Flight));

The xml it's referring to was:

<AirlineFeed>
 <Flight xmlns:"urn:cfi" name:"AS515">
  <Seats>123</Seats>
 </Flight>

 <Flightname:"UN24">
  <Seats>96</Seats>
 </Flight>
</AirLineFeed>

What does the curly bracket do? Thanks.

1

There are 1 answers

4
Michael Nelson On BEST ANSWER

From the page you linked: https://msdn.microsoft.com/en-us/library/bb353813(v=vs.110).aspx

The method XContainer.Descendants() takes a paramater XName of type System.Xml.Linq.XName.

If you look at the msdn page for System.Xml.Linq.XName: https://msdn.microsoft.com/en-us/library/system.xml.linq.xname(v=vs.110).aspx

You can see from Remarks:

XML names include a namespace and a local name. A fully qualified name is the combination of the namespace and local name.

and from Using Expanded Names

You can also create an XName from a expanded XML name in the form {namespace}localname