XElement element = new XElement("MyElement", new XAttribute("Author", "John"), new XAttribute("DateCreated", DateTime.Now.ToString()), "My element value");
XElement element = XElement.Load("myfile.xml"); string author = element.Attribute("Author").Value;This code loads an existing XML file and extracts the value of the "Author" attribute from the root element. Package Library: System.Xml.Linq