2
Reply

Why not private variables serialized with xmlserializer?

Murali Poola

Murali Poola

12y
6.4k
0
Reply

    XMLSerializer is introduced in .NET 1.0 and specially designed for working with ASMX services. As per the design, it requires to serialize only public properties.Also, XMLSerializer depends on the serialization assembly generated during run-time. XMLSerializer uses this runtime-generated assembly to serialize types. Doesn't use reflection. Hence, private variables are not serialized.

    You cannot serialize private members using XmlSerializer unless your class implements the interface IXmlSerializable.