I had a problem where the data serialized got “messed up”. It was a string that contained control chars (tabs, carriage return, line feed, etc.).
Without anything special, the serializer will just “dump” the content directly in the XML (as is). Having XML what it is, it ignored these special characters when deserializing.
Let's say that the text to save is:
”Hi,
My name is John Doe”
There XML resulting in the serializer will become:
<...>
<myString>Hi,
My name is John Doe</myString>
</...>
When it gets deserialized, The Carriage Return gets lost.
Trick:
Add the following attribute
[
XmlElement(DataType = "anyURI")]
public
string myString
Pat