![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I'm using classes generated from xsd.exe. I am serializing them with XmlTextWriter, and everything works fine. Our customer, though, has a silly requirement that dollar amounts (in the .xsd as decimals) be formatted to always include cents (regardless if there are cents or not). I'm interested in using the classes to only output data (i.e. I'm not parsing incoming data) I've tried setting up the following construct to format the output of each of the affected decimal fields, but I don't get anything written out to the .xml file. What am I missing - and is there a better way? /// Override for Amount output [System.Xml.Serialization.XmlAttributeAttribute(Att ributeName = "Amount", DataType="string")] public string AmountString { get { return string.Format("#0.00", this.amountField); } } [System.Xml.Serialization.XmlIgnore()] public decimal Amount { get { return this.amountField; } set { this.amountField = value; } |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |