Reputation: 1333
I have a program that'll serialize a number of different objects into xml files stored on disk, with an arbitrary name (I can't change the naming)... how do I deserialize these objects again??
As I can see it, I need to read the XML file using an XML doc reader to figure out what type of object is stored in each file, and then use this type when creating an instance of the deserializer. But is seems like a lot of work to first load the file as XML and then deserialize into a the correct object...
Is there a smarter way? Does there exist a library for doing this?
Upvotes: 0
Views: 941
Reputation: 5912
You could have an XmlSerializer for each class, and then try the CanDeserialize method for each xml file.
Upvotes: 2