XContainer.FirstNode Property


Gets the first child node of this node.

 property System::Xml::Linq::XNode ^ FirstNode { System::Xml::Linq::XNode ^ get(); };
public System.Xml.Linq.XNode FirstNode { get; }
member this.FirstNode : System.Xml.Linq.XNode
Public ReadOnly Property FirstNode As XNode

Property Value

An XNode containing the first child node of the XContainer.


The following example creates an element that contains child elements. It then gets the first child node of the parent element.

XElement xmlTree = new XElement("Root",  
    new XElement("Child1", 1),  
    new XElement("Child2", 2),  
    new XElement("Child3", 3),  
    new XElement("Child4", 4),  
    new XElement("Child5", 5)  
XNode firstNode = xmlTree.FirstNode;  
Dim xmlTree As XElement = _   
Dim firstNode As XNode = xmlTree.FirstNode  

This example produces the following output:


Applies to

See also