Mega Code Archive

 
Categories / C# / XML
 

Gets an XmlAttributeCollection containing the list of attributes

using System; using System.IO; using System.Xml; public class Sample {   public static void Main()   {     XmlDocument doc = new XmlDocument();     doc.LoadXml("<book genre='Computer' ISBN='1-111111-11-1'>" +                 "<title>C#</title>" +                 "</book>");     XmlElement root = doc.DocumentElement;     root.Attributes[0].Value="fiction";     Console.WriteLine("Display the modified XML...");     Console.WriteLine(doc.InnerXml);   } }