nodes
Annotations applied to an XElement instance
XElement customer = XElement.Load(@"..\..\customer.xml");
CustomerAnnotation annotation = new CustomerAnnotation();
annotation.Notes = "This is a good customer!";
customer.AddAnnotation(annotation);
CustomerAnnotation is a custom type and can be any .NET type. We can then retrieve annotationsfrom XML nodes by using one of the two generic methods, Annotation
annotation = customer.Annotation
Because XObject is the base class of every kind of X* class that is used to describe an XML
node, annotations can be added to any node. Usually, annotations are used to keep state
information, such as the mapping to source entities or documents used to build XML, while
the code handles real XML content.
No comments:
Post a Comment