Home All Groups Group Topic Archive Search About

Could we control the order of Properties when using System.xml.Serialize

Author
11 Nov 2005 3:37 AM
Si Jingnan
Hi,
    When using System.Xml.Serialize, could we control the output order of
proeprties? I want to first render some properties, then another based
on different cases, or I want to first output derived class's properties
then base class's, Is there any programming way to do it?

Thanks
Jingnan

Author
12 Nov 2005 7:40 AM
Manoj G [MVP]
Hi Jingnan,

I guess you will have to implement the IXmlSerializable interface for having
that sort of control. Unfortunately, this interface is
undocumented/unsupported until now, .NET 2.0.
You also may want to look at this blog post form more info on the same.
http://weblogs.asp.net/cweyer/archive/2004/08/02/205798.aspx

--
HTH,
Manoj G
MVP, Visual Developer
http://msmvps.com/manoj

Show quote
"Si Jingnan" <jingnan***@gmail.com> wrote in message
news:%23UVBaEn5FHA.3188@TK2MSFTNGP15.phx.gbl...
> Hi,
> When using System.Xml.Serialize, could we control the output order of
> proeprties? I want to first render some properties, then another based on
> different cases, or I want to first output derived class's properties then
> base class's, Is there any programming way to do it?
>
> Thanks
> Jingnan
Author
14 Nov 2005 1:10 AM
Si Jingnan
Manoj G [MVP] wrote:
> Hi Jingnan,
>
> I guess you will have to implement the IXmlSerializable interface for having
> that sort of control. Unfortunately, this interface is
> undocumented/unsupported until now, .NET 2.0.
> You also may want to look at this blog post form more info on the same.
> http://weblogs.asp.net/cweyer/archive/2004/08/02/205798.aspx
>

Thank you, I have tried the IXmlSerializable in .Net 2.0, it works fine,
but not work in .Net 1.1, Is there any way to do it under .Net 1.1?

Regards
Jingnan

AddThis Social Bookmark Button