B
Bob Rock
Hello,
I have a web method that serializes a class that includes among its public
fields a System.Object field to which, at runtime, I assign instances of
various different classes.
When XmlSerializer tries serializing this public field's real content I get
a "The type namespace.classname was not expected. Use the XmlInclude or
SoapInclude attribute to specify types that are not known statically.". I
suppose this is due to the fact that XmlSerializer has not been informed of
what the class types of class instances that may come to be loaded in this
public field at runtime.
I think I only need to specify on the System.Object field the instance
object classes that it may come to "contain" at runtime ... unfortunately
this cannot be done with the XmlInclude attribute (which can only be applied
to methods). How can I solve this problem???
Thx.
Bob Rock
I have a web method that serializes a class that includes among its public
fields a System.Object field to which, at runtime, I assign instances of
various different classes.
When XmlSerializer tries serializing this public field's real content I get
a "The type namespace.classname was not expected. Use the XmlInclude or
SoapInclude attribute to specify types that are not known statically.". I
suppose this is due to the fact that XmlSerializer has not been informed of
what the class types of class instances that may come to be loaded in this
public field at runtime.
I think I only need to specify on the System.Object field the instance
object classes that it may come to "contain" at runtime ... unfortunately
this cannot be done with the XmlInclude attribute (which can only be applied
to methods). How can I solve this problem???
Thx.
Bob Rock