Mega Code Archive

 
Categories / C# Tutorial / XML
 

Get child count

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Xml;     public class MainClass     {         public static void Main()         {             XmlDocument doc = new XmlDocument();             doc.PreserveWhitespace = true;             doc.Load(Application.StartupPath + @"\employees.xml");             MessageBox.Show("Employee node contains " + doc.DocumentElement.ChildNodes.Count +" child nodes");         }     }