Consider the following code.
<DataContract()> _
Public Class BaseType
<DataMember()> Public zebra As String
End Class
<DataContract()> _
Public Class DerivedType
Inherits BaseType
<DataMember(Order:=0)> Public bird As String
<DataMember(Order:=1)> Public parrot As String
<DataMember()> Public dog As String
<DataMember(Order:=3)> Public antelope As String
<DataMember()> Public cat As String
<DataMember(Order:=1)> Public albatross As String
End Class
[DataContract]
public class BaseType
{
[DataMember]
public string zebra;
}
[DataContract]
public class DerivedType : BaseType
{
[DataMember(Order = 0)]
public string bird;
[DataMember(Order = 1)]
public string parrot;
[DataMember]
public string dog;
[DataMember(Order = 3)]
public string antelope;
[DataMember]
public string cat;
[DataMember(Order = 1)]
public string albatross;
}
The XML produced is similar to the following.
<DerivedType>
<!-- Zebra is a base data member, and appears first. -->
<zebra/>
<!-- Cat has no Order, appears alphabetically first. -->
<cat/>
<!-- Dog has no Order, appears alphabetically last. -->
<dog/>
<!-- Bird is the member with the smallest Order value -->
<bird/>
<!-- Albatross has the next Order value, alphabetically first. -->
<albatross/>
<!-- Parrot, with the next Order value, alphabetically last. -->
<parrot/>
<!-- Antelope is the member with the highest Order value. Note that
Order=2 is skipped -->
<antelope/>
</DerivedType>