XmlElementAttribute.Namespace 屬性

定義

取得或設定指派給類別序列化時所產生之 XML 項目的命名空間。

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

屬性值

String

XML 項目的命名空間。

備註

屬性 Namespace 符合 WORLD Wide Web Consortium 規格, XML 中的命名空間

若要建立與前置詞相關聯的命名空間,您必須建立 XmlSerializerNamespaces ,其中包含 XML 檔中所使用的命名空間和前置詞。 當您設定每個 XmlArrayAttribute 的命名空間時,它必須符合 中的 XmlSerializerNamespaces 其中一個命名空間。 產生 XML 時,每個陣列都會正確加上與指定命名空間相關聯的前置詞。

適用於