Search code examples
silverlightserializationdatacontractserializerdeserialization

How do I serialize read-only objects in silverlight?


I'm having a problem now: for serializing/deserializing an object which has only getters marked as public with DataContractSerializer I have to use [InternalsVisibleTo] attribute and to make setters internal.

How can I avoid this ugly workaround to get my read-only objects successfully serialized/deserialized? Implementing ISerializable/IXmlSerializable is the last thing I want to do. Do I have any other ways to do this?

Thanks in advance.
Alexander


Solution

  • I've ended up with IXmlSerializable.