C# Deserialization problem into new class structure
I 开发者_如何学Gohave a class and serialized into XML on hard disk. Then I add one new parameter into that class. Can I still able be de-serialize from old xml into new class structure by default de-serializer?
Any things else might affect serialization? Rename parameters ? Delete parameters ?
I will assume by parameters you are referring to instance variables.
XMLSerializer will just put back the data it can find. Even if you removed (or renamed) a variable it will still be happy.
If however you are saying that you have added a parameter to the constructor just be aware that XMLSerializer requires a parameterless constructor.
精彩评论