控制編碼 SOAP 序列化的屬性Attributes That Control Encoded SOAP Serialization

名為 World Wide Web Consortium (W3C) 文件簡易物件存取通訊協定 (SOAP) 1.1包含描述 SOAP 參數如何編碼的選擇性章節 (第 5 節)。The World Wide Web Consortium (W3C) document named Simple Object Access Protocol (SOAP) 1.1 contains an optional section (section 5) that describes how SOAP parameters can be encoded. 若要遵循第 5 節的規格,您必須使用在 System.Xml.Serialization 命名空間中的特殊屬性集。To conform to section 5 of the specification, you must use a special set of attributes found in the System.Xml.Serialization namespace. 套用適合類別與類別成員的那些屬性,然後使用 XmlSerializer 序列化類別的執行個體。Apply those attributes as appropriate to classes and members of classes, and then use the XmlSerializer to serialize instances of the class or classes.

下表顯示屬性、其可套用位置及作用。The following table shows the attributes, where they can be applied, and what they do. 如需使用這些屬性控制 XML 序列化的詳細資訊,請參閱How to:物件序列化為 SOAP 編碼的 XML StreamHow to:覆寫編碼的 SOAP XML 序列化For more information about using these attributes to control XML serialization, see How to: Serialize an Object as a SOAP-Encoded XML Stream and How to: Override Encoded SOAP XML Serialization.

如需屬性的詳細資訊,請參閱屬性For more information about attributes, see Attributes.

屬性Attribute 適用於Applies to 指定Specifies
SoapAttributeAttribute 公用欄位、屬性、參數或傳回值。Public field, property, parameter, or return value. 類別成員將會序列化成 XML 屬性。The class member will be serialized as an XML attribute.
SoapElementAttribute 公用欄位、屬性、參數或傳回值。Public field, property, parameter, or return value. 類別將會序列化成 XML 項目。The class will be serialized as an XML element.
SoapEnumAttribute 為列舉識別項的公用欄位。Public field that is an enumeration identifier. 列舉成員的項目名稱。The element name of an enumeration member.
SoapIgnoreAttribute 公用屬性與欄位。Public properties and fields. 所屬類別序列化時,略過屬性或欄位。The property or field should be ignored when the containing class is serialized.
SoapIncludeAttribute 公用衍生類別宣告以及 Web 服務描述語言 (WSDL) 文件的公用方法。Public-derived class declarations and public methods for Web Services Description Language (WSDL) documents. 當產生結構描述時應包含型別 (在序列化時辨認)。The type should be included when generating schemas (to be recognized when serialized).
SoapTypeAttribute 公用類別宣告Public class declarations. 類別應序列化成 XML 型別。The class should be serialized as an XML type.

另請參閱See also