Export (0) Print
Expand All

MessageBodyMemberAttribute.Order Property

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

Namespace:  System.ServiceModel
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public int Order { get; set; }

Property Value

Type: System.Int32
The location of the element in the SOAP body.

ExceptionCondition
ArgumentOutOfRangeException

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

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.

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;
}

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2014 Microsoft