Deserialize random/unknown types with XmlSerializer

This question already has an answer here:

  • Deserialize XML To Object using Dynamic 1 answer

  • 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

    上一篇: XmlSerializer反序列化具有不同元素名称的列表

    下一篇: 使用XmlSerializer反序列化随机/未知类型