Microsoft
70-516 · Question #37
Which method will return all nodes of an XDocument?
The correct answer is A. doc.DescendantNodes(). public IEnumerable<XNode> DescendantNodes() Returns a collection of the descendant nodes for this document or element, in document order. public IEnumerable<XElement> Descendants() Returns a collection of the descendant elements for this document or element, in document order.
Querying Data
Question
Which method will return all nodes of an XDocument?
Options
- Adoc.DescendantNodes();
- Bdoc.Descendants();
- Cdoc.Root.Allnodes();
- Ddoc.GetAllnodes();
How the community answered
(27 responses)- A70% (19)
- B4% (1)
- C7% (2)
- D19% (5)
Explanation
public IEnumerable<XNode> DescendantNodes() Returns a collection of the descendant nodes for this document or element, in document order. public IEnumerable<XElement> Descendants() Returns a collection of the descendant elements for this document or element, in document order.
Topics
#LINQ to XML#XDocument#DescendantNodes#XML traversal
Community Discussion
No community discussion yet for this question.