Custom Serialization/De-serialization Issue
Given this XML element:
<SampleA>0</SampleA>
Why is reader.HasValue
resolving to false when the element clearly has a value ("0")?
if (reader.HasValue)
this.Sam开发者_JS百科pleA = Int32.Parse(reader.ReadElementString("SampleA"));
Is this the correct property to check for the above purpose?
This could be because your reader is on another node.
You may want to try:
if( reader.MoveToContent() == XmlNodeType.Element && reader.LocalName == "SampleA") {
}
精彩评论