I\'ve discovered that if a serializable Field/Property has a corresponding field of type Boolean having as a name the Field/Property name with \"S
I will extend answer of Martin Peck.
You can avoid serialization of the fields/properties with "Specified" suffix.
You should define that "*Specified" properties in your class and apply [XmlIgnoreAttribute()]
to them.
Here is an example:
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://yournamespace.com")]
public partial class YourObject
{
private long sessionTimeoutInSecondsField;
private bool sessionTimeoutInSecondsFieldSpecified;
public long sessionTimeoutInSeconds
{
get
{
return this.sessionTimeoutInSecondsField;
}
set
{
this.sessionTimeoutInSecondsField = value;
}
}
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool sessionTimeoutInSecondsSpecified
{
get
{
return this.sessionTimeoutInSecondsFieldSpecified;
}
set
{
this.sessionTimeoutInSecondsFieldSpecified = value;
}
}
}