Generalised XML Serialization

Posted by Tom W on Stack Overflow See other posts from Stack Overflow or by Tom W
Published on 2010-06-13T12:02:56Z Indexed on 2010/06/13 12:12 UTC
Read the original article Hit count: 244

I apologise for asking a question that's probably been asked hundreds of times before, but I don't seem to be able to find an answer in the archives; probably because my question is too basic.

I know that XML Serialization by default only touches public members and properties. Properties very often mask a private variable; particularly if they're readonly. Serializing these is fine; the value that the instance exposes to the world is what goes into the XML. But if Deserialization of the same data can't put the value back where it belongs, what's the point of doing it? Is there something I'm missing about how XML Serialization is normally used for classes with masking properties? Surely it can't be that the only answer is explicitly implementing Read/WriteXML - because that's more effort than it's worth!

© Stack Overflow or respective owner

Related posts about .NET

Related posts about properties