Groups | Blog | Home
all groups > dotnet xml > november 2005 >

dotnet xml : How to serialize number to specific format


eSapient
11/30/2005 12:24:04 PM
In the code I use for serialization/deserialization is the following:

[XmlElementAttribute(Form=XmlSchemaForm.Unqualified)]
public Decimal valArcBegAngle
{
[return: MarshalAs(UnmanagedType.Currency)]
get {return m_valArcBegAngle;}
[param: MarshalAs(UnmanagedType.Currency)]
set {m_valArcBegAngle = value;}
}
private Decimal m_valArcBegAngle;

What can I do so that, if the value is zero, the output is
<valArcBegAngle>000</valArcBegAngle> instead of
<valArcBegAngle>0</valArcBegAngle>?

Thanks in advance.
DC
11/30/2005 5:54:36 PM
use a surrogate.

example:
http://cheeso.members.winisp.net/srcview.aspx?dir=xml-serialization&file=Surrogate.cs


--
-Dino
D i n o . C h i e s a AT M i c r o s o f t . c o m


[quoted text, click to view]

AddThis Social Bookmark Button