Is there any way to create an XmlSerializer that stores along with the serialized data the data type, then when deserializing, it automatically identifies the type of the serialized object and creates an object of that type (returned as object).
Any idea that includes XDocument, XML-literals would be welcommed too.
Regarding John Saunders' good observation about the NetDataContractSerializer. The NetDataContractSerializer is pretty obscure, almost an Easter Egg for XML Serialization. I have VB.NET specific blog post that shows how to create the source code for the necessary attribute, and what the resultant XML looks, http://bejabbers2.blogspot.com/2010/03/making-case-for-netdatacontractserializ.html. Here is what a serialized class looks like