XmlElementAttribute.Namespace Property

Definition

Gets or sets the namespace assigned to the XML element that results when the class is serialized.

public:
 property System::String ^ Namespace { System::String ^ get(); void set(System::String ^ value); };
public string Namespace { get; set; }
public string? Namespace { get; set; }
member this.Namespace : string with get, set
Public Property Namespace As String

Property Value

The namespace of the XML element.

Remarks

The Namespace property conforms to the World Wide Web Consortium specification, Namespaces in XML.

To create namespaces that are associated with a prefix, you must create an XmlSerializerNamespaces that contains the namespaces and prefixes used in the XML document. As you set the namespace for each XmlArrayAttribute, it must match one of the namespaces in the XmlSerializerNamespaces. When the XML is generated, each array is correctly prefixed with the prefix associated with the specified namespace.

Applies to