XObject Class

XObject Class

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Represents a node or an attribute in an XML tree.

System::Object
  System.Xml.Linq::XObject
    System.Xml.Linq::XAttribute
    System.Xml.Linq::XNode

Namespace:  System.Xml.Linq
Assembly:  System.Xml.Linq (in System.Xml.Linq.dll)

No code example is currently available or this language may not be supported.

The XObject type exposes the following members.

  NameDescription
Public propertyBaseUriGets the base URI for this XObject.
Public propertyDocumentGets the XDocument for this XObject.
Public propertyNodeTypeGets the node type for this XObject.
Public propertyParentGets the parent XElement of this XObject.
Top

  NameDescription
Public methodAddAnnotationAdds an object to the annotation list of this XObject.
Public methodAnnotation(Type)Gets the first annotation object of the specified type from this XObject.
Public methodAnnotation<T>()Get the first annotation object of the specified type from this XObject.
Public methodAnnotations(Type)Gets a collection of annotations of the specified type for this XObject.
Public methodAnnotations<T>()Gets a collection of annotations of the specified type for this XObject.
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodRemoveAnnotations(Type)Removes the annotations of the specified type from this XObject.
Public methodRemoveAnnotations<T>()Removes the annotations of the specified type from this XObject.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public eventChangedRaised when this XObject or any of its descendants have changed.
Public eventChangingRaised when this XObject or any of its descendants are about to change.
Top

  NameDescription
Explicit interface implemetationPrivate methodIXmlLineInfo::HasLineInfoGets a value indicating whether or not this XObject has line information.
Explicit interface implemetationPrivate propertyIXmlLineInfo::LineNumberGets the line number that the underlying XmlReader reported for this XObject.
Explicit interface implemetationPrivate propertyIXmlLineInfo::LinePositionGets the line position that the underlying XmlReader reported for this XObject.
Top

This class is the abstract common base class for XNode and XAttribute. It provides some basic functionality that is common to both classes, such as annotations, and raising events when nodes have changed.

Note that annotations are not part of the XML infoset; they are not serialized or deserialized.

The following example creates a document with some complex content. It then uses this property to retrieve the document for the Child element.

No code example is currently available or this language may not be supported.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Show:
© 2017 Microsoft