I have a class (call it Container) which is serialized and deserialized using the DataContractSerializer. The class contains a collection of other classes, all of which inherit the same base class (call it ContentsBase), but which have distinct derived classes. The application may be passed a serialized Container object which contains ContentsBase-derived objects whose implementation I do not know or have access to -- that is, the compiled code is not available locally. I need to deserialize this object by "ignoring" the types I don't know about (I don't need to round-trip them).
Is there any way I can do this, short of taking the serialized XML and writing some custom code to grovel through it and remove unknown elements before deserialization, or is that my only option?
Serialization surrogates and serialization binder
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With