Contains the XML namespaces and prefixes that the XmlSerializer uses to generate qualified names in an XML-document instance.
Assembly: System.Xml (in System.Xml.dll)
Thetype exposes the following members.
|XmlSerializerNamespaces()||Initializes a new instance of the class.|
|XmlSerializerNamespaces(XmlQualifiedName)||Initializes a new instance of the class.|
|XmlSerializerNamespaces(XmlSerializerNamespaces)||Infrastructure. Initializes a new instance of the class, using the specified instance of XmlSerializerNamespaces containing the collection of prefix and namespace pairs.|
|Add||Adds a prefix and namespace pair to an object.|
|Equals(Object)||Determines whether the specified object is equal to the current object. (Inherited from Object.)|
|Finalize||Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)|
|GetHashCode||Serves as the default hash function. (Inherited from Object.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|ToArray||Gets the array of prefix and namespace pairs in an object.|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
The contains a collection of XML namespaces, each with an associated prefix. The XmlSerializer uses an instance of the class to create qualified names in an XML document.
XML namespaces contained by the must conform to the www.w3.org specification named Namespaces in XML.
XML namespaces provide a way to qualify the names of XML elements and attributes in XML documents. A qualified name consists of a prefix and a local name, separated by a colon. The prefix functions only as a placeholder; it is mapped to a URI that specifies a namespace. The combination of the universally-managed URI namespace and the local name produces a name that is guaranteed to be universally unique.
To create qualified names in an XML document:
Create an instance.
Add each prefix and namespace pair that you want to the instance.
Apply the appropriate.NET attribute to each property or class that the XmlSerializer serializes into an XML document. The available attributes are:
Set the Namespace property of each attribute to one of the namespace values from the object.
The creation of an empty namespace and prefix pair is not supported. That is, you cannot create a pair using the following code:
The following example creates an object, and adds two prefix and namespace pairs to it. The example then passes the to the Serialize method, which serializes a Books object into an XML document. Using the object, the Serialize method qualifies each XML element and attribute with one of the two namespaces.
.NET FrameworkSupported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1
.NET Framework Client ProfileSupported in: 4, 3.5 SP1
XNA FrameworkSupported in: 3.0, 2.0, 1.0
Portable Class LibrarySupported in: Portable Class Library
Supported in: Windows Phone 8.1
Supported in: Windows Phone Silverlight 8.1
Supported in: Windows Phone Silverlight 8