Creating a Comment and Adding It to Its Element
using System; using System.Linq; using System.Xml.Linq; using System.Collections.Generic; class Program//from w w w . j a v a 2 s. com { static void Main(string[] args){ XElement xBook = new XElement("Book"); XComment xComment = new XComment("This person is retired."); xBook.Add(xComment); Console.WriteLine(xBook); } }