FirstNode and LastNode give you direct access to the first or last child node : Children : XML LINQ C# Source Code


Custom Search

C# Source Code » XML LINQ » Children »

 

FirstNode and LastNode give you direct access to the first or last child node








    
 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
public class MainClass {
    public static void Main() {

        var bench = new XElement("bench",
                      new XElement("t",
                        new XElement("B", "H"),
                        new XElement("A", "R")
                      ),
                      new XElement("t",
                        new XElement("B", "S"),
                        new XElement("A", "N")
                      ),
                      new XComment("This is the comment")
                    );
        foreach (XNode node in bench.Nodes())
            Console.WriteLine(node.ToString(SaveOptions.DisableFormatting) + ".");
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo XML LINQ
» Children