XElement element = new XElement("book", "The Lord of the Rings"); string bookTitle = element.ElementAsString; // bookTitle will be "The Lord of the Rings"
XElement element = new XElement("book", new XElement("title", "The Hobbit"), new XElement("author", "J.R.R. Tolkien")); string xmlString = element.ToString(); // xmlString will be "In this example, a new XElement is created with the name "book" and two child elements, "title" and "author". The ToString() method is then used to get the XML string representation of the element, which is assigned to the xmlString variable. The System.Xml.Linq package library is used in .NET Framework and .NET Core for working with XML data in a LINQ (Language-Integrated Query) enabled manner." The Hobbit J.R.R. Tolkien