I have an XML with an optional tag as follows:
<Config>
<MyTag>true<MyTag>
<!-- more tags -->
</Config>
And the class-definition:
public class config {
[System.Xml.Serialization.XmlElement("CheckForCompleteTransform")]
public bool? CheckForCompleteTransform { get; set; }
}
This works if I either set the tag to what I provided within my example-XML above or I omit it completely. But what if I provide the tag as <MyTag/>? If this notation is used I want the serializer to set the corresponding property within my class to true, but I awlays get a
System.FormatException: the string literal '' is not valod for type Boolean
Any ideas on how to achieve this?
No comments:
Post a Comment