Rediger

Del via


MessageBodyMemberAttribute.Order Property

Definition

Gets or sets a value that indicates the position in which the member is serialized into the SOAP body.

public:
 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

Property Value

The location of the element in the SOAP body.

Exceptions

The value passed to the property setter is a negative integer.

Examples

The following code example uses the Order property to serialize the sourceAccount value first, the targetAccount value second and the amount value third. If the Order property is not used, the amount value is serialized first.

[MessageContract]  
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;  
}  

Remarks

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. The semantics of this property are the same as the semantics of the Order property.

Applies to