2011-12-15 88 views
3

我是xml序列化對象,我似乎無法改變字段序列化的順序。序列化時的順序字段

I.e.

public class foo{ 
string a {get;set;} 
string b {get;set;} 
} 

出來的(僞)

<foo b="world" a="hello" /> 

當我需要

<foo a="hello" b="world" /> 

誰能幫助?

+1

,兩個輸出是等價的。你的消費程序不符合XML標準嗎?無論如何,我不認爲沒有自定義序列化過程是可能的。它適用於具有[Order property of XmlElementAttribute class](http://msdn.microsoft.com/zh-cn/library/system.xml.serialization.xmlelementattribute.order.aspx)的元素,並且沒有屬性 – 2011-12-15 09:49:40

回答