Default values are not serialized

Nov 19, 2010 at 9:16 PM
Edited Nov 19, 2010 at 9:27 PM

In my xsd, default value is specified like below. Default value is not getting serialized but other fields are serialized.

xsd

 <

 

 

 

 

 

 

 

/>

 

 

 

 

 

 

xs:simpleType name="PositiveDecimalUpto100"

 

xs:restriction base="xs:decimal"

 

xs:fractionDigits value="2"

 

xs:minInclusive value="0"

 

xs:maxInclusive value="100"

 

xs:restriction

 

xs:simpleType

 XSD2CODE generated code...

XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]

[System.ComponentModel.

DefaultValueAttribute(typeof(decimal), "100.00")]

 

public decimal ResidentialFactor

{

 

get

{

 

return this.residentialFactorField;

}

 

set

{

 

this.residentialFactorField = value;

}

}

 

 

Any help would be highly appreciated.



 Thanks,

Anand

>

 

>

 

 

 

/>

 

 

 

/>

 

 

 

/>

 

 

 

>

 

 

 

>

 

 

 

 

 

 

<

<

<

<

<

</

</

[System.Xml.Serialization.

 

 

xs:element name="ResidentialFactor" type="PositiveDecimalUpto100" minOccurs="0" maxOccurs="1" default="100.00