Partager via


XmlSerializerNamespaces.Add Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Adds a prefix and namespace pair to an XmlSerializerNamespaces object.

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

Syntax

'Declaration
Public Sub Add ( _
    prefix As String, _
    ns As String _
)
public void Add(
    string prefix,
    string ns
)

Parameters

  • prefix
    Type: System.String
    The prefix associated with an XML namespace.

Remarks

If you want the XmlSerializer to qualify the element and attribute names in an XML document, you must Add the prefix and namespace pairs to an XmlSerializerNamespaces object.

Any namespaces that you add must conform to the www.w3.org specification, Namespaces in XML.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.