Is it possible to deserialize (c#) a piece of xml, csv, json (whatever it is), and not know it's type? But be given back an object (which ultimately is the correct type)?
Yes, it is possible.
The serialized XML/CSV/JSON data must contain identifiers to allow the deserializer to know what types of objects to create, since this can't be known beforehand. So that the deserializer can construct new object instances, the FactoryMethod design pattern is usually employed.
Deserialization is harder than serialization.
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