Adds an object to the annotation list of this XObject.
using System; using System.Xml.Linq; public class MyAnnotation { private string tag; public string Tag {get{return tag;} set{tag=value;}} public MyAnnotation(string tag) { this.tag = tag; } } public class Program { public static void Main(string[] args) { MyAnnotation ma = new MyAnnotation("T1"); XElement root = new XElement("Root", "content"); root.AddAnnotation(ma); MyAnnotation ma2 = (MyAnnotation)root.Annotation<MyAnnotation>(); Console.WriteLine(ma2.Tag); } }