Deserialize random/unknown types with XmlSerializer
This question already has an answer here:
I don't know whether it is better or not but you may try DynamicObject
approach. http://blogs.msdn.com/b/csharpfaq/archive/2009/10/19/dynamic-in-c-4-0-creating-wrappers-with-dynamicobject.aspx
As you mentioned when you request for the service might return . So do you know if an request is made for a type then the service might return only certain types back?
I would have tried XmlSerializer Constructor (Type, Type[])... Initializes a new instance of the XmlSerializer class that can serialize objects of the specified type into XML documents, and deserialize XML documents into object of a specified type. If a property or field returns an array, the extraTypes parameter specifies objects that can be inserted into the array.
链接地址: http://www.djcxy.com/p/54906.html