Serialize Element Order

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lars

    #1

    Serialize Element Order

    Hello All,
    I have a question: is it possible to set the order of the elements of
    serialized object?

    Lets say we have

    Public Class Order
    Public Price As Decimal
    Private Quantity As Decimal
    Public Readonly Property Total() As Decimal
    Get
    Return Quantity * Price
    End Get
    End Property
    <System.Xml.Ser ialization.XmlE lementAttribute ("Address")> _
    Public Address() As Address
    End Class
    Class Address
    .......

    When Serializing the class Order I expected the outcome to be in this order:

    <Order>
    <price />
    <quantity />
    <total />
    <adress />
    <Order>

    But the <total> element is always serialized behind the Address element.

    <Order>
    <price />
    <quantity />
    <adress />
    <total />
    <Order>
    (seems to be, because it as a Property)

    I know to XML this is no problem but one of our partners is parsing the XML
    as a Textfile and so will not find the expected Atribute.

    Thanks in advance.


Working...