XDeclaration Class

XDeclaration Class

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

Represents an XML declaration.

System::Object
  System.Xml.Linq::XDeclaration

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 XDeclaration type exposes the following members.

  NameDescription
Public methodXDeclaration(XDeclaration)Initializes a new instance of the XDeclaration class from another XDeclaration object.
Public methodXDeclaration(String, String, String)Initializes a new instance of the XDeclaration class with the specified version, encoding, and standalone status.
Top

  NameDescription
Public propertyEncodingGets or sets the encoding for this document.
Public propertyStandaloneGets or sets the standalone property for this document.
Public propertyVersionGets or sets the version property for this document.
Top

  NameDescription
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 methodToStringProvides the declaration as a formatted string. (Overrides Object::ToString().)
Top

An XML declaration is used to declare the XML version, the encoding, and whether or not the XML document is standalone. This class represents the XML concept of an XML declaration.

Just as in the XML standard, declarations are associated with a document. When you create a document, you have the option to specify the declaration for the document. The XDocument class contains the Declaration property, which allows you to set or get the declaration.

The following example creates a document that contains a declaration.

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