MessageBodyMemberAttribute.Order 屬性


取得或設定值,這個值會指出成員序列化至 SOAP 本文的位置。Gets or sets a value that indicates the position in which the member is serialized into the SOAP body.

 property int Order { int get(); void set(int value); };
public int Order { get; set; }
member this.Order : int with get, set
Public Property Order As Integer



SOAP 本文中項目的位置。The location of the element in the SOAP body.


傳給屬性 setter 的值會是負整數。The value passed to the property setter is a negative integer.


下列程式碼使用 Order 屬性先序列化 sourceAccount 值,第二是 targetAccount 值,而第三為 amount 值。The following code example uses the Order property to serialize the sourceAccount value first, the targetAccount value second and the amount value third. 若未使用 Order 屬性,請先序列化 amount 值。If the Order property is not used, the amount value is serialized first.

public class BankingTransaction  
  [MessageHeader] public Operation operation;  
  [MessageBodyMember(Order=1)] public Account sourceAccount;  
  [MessageBodyMember(Order=2)] public Account targetAccount;  
  [MessageBodyMember(Order=3)] public int amount;  


使用 Order 屬性指定 SOAP 本文項目中資料成員的位置。Use the Order property to specify the location of a data member in the SOAP body element. 值不需要連續,因此它不代表成員的位置,只是排序鍵。The value is not required to be consecutive, because it does not represent the position of the member, only the sorting key.

本文項目預設為依字母排序。The order of the body elements is alphabetical by default. 此屬性的語意與 Order 屬性的語意相同。The semantics of this property are the same as the semantics of the Order property.