I've got an interface that two classes implement at the moment. The data for these classes is read in from an xml file.
e.g.
[Serializable]
public interface IMyInterface { }
[Serializable]
public class MyClass1 : IMyInterface { }
[Serializable]
public class MyClass2 : IMyInterface { }
I want to infer the type from the Xml, is there a way of doing that?
So for example my xml looks like this:
<meta type="MyClass1">
<!--- Some meta data -->
</meta>
I want to be able to directly serialize from xml into objects. Currently I'm manually processing the xml.
Edit: To clarify, I know how to serialize out but I can't serialize back in without knowing which type it is first. Should I read the type attribute and then serialize based on that?