SoapAttribute.UseAttribute 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定一個值,指示當前屬性的目標是否會序列化為 XML 屬性,而非 XML 欄位。
public:
virtual property bool UseAttribute { bool get(); void set(bool value); };
public virtual bool UseAttribute { get; set; }
member this.UseAttribute : bool with get, set
Public Overridable Property UseAttribute As Boolean
屬性值
true 如果當前屬性的目標物件必須序列化為 XML 屬性; false 如果目標物件必須序列化為子元素。
備註
例如,若 FieldA 物件欄位 ObjectB 以屬性為限定 SoapFieldAttribute(UseAttribute=true) , FieldA 則會序列化為 <ObjectB><FieldA>5</FieldA></ObjectB>。 若 UseAttribute 屬性設為 false, FieldA 則序列化為 <ObjectB FieldA="5"></ObjectB>。