C
Craig Buchanan
I am trying to serialize a class called Order to the ViewState. Order has
one property called LineItems, which is an ArrayList. The ArrayList holds
instances of a class named LineItem. Bother Order and LineItem are marked
with the <Serializable> attribute.
When I attempt to serialize the class using this code:
Dim xs As XmlSerializer = New XmlSerializer(GetType(Order))
Dim sw As New StringWriter()
xs.Serialize(sw, _Order)
ViewState("LineItems") = sw.ToString()
On the line xs.Serialize(sw, _Order), I get an error that reads:
The type LineItem was not expected. Use the XmlInclude or SoapInclude
attribute to specify types that are not known statically.
What am I missing?
Thanks,
Craig Buchanan
one property called LineItems, which is an ArrayList. The ArrayList holds
instances of a class named LineItem. Bother Order and LineItem are marked
with the <Serializable> attribute.
When I attempt to serialize the class using this code:
Dim xs As XmlSerializer = New XmlSerializer(GetType(Order))
Dim sw As New StringWriter()
xs.Serialize(sw, _Order)
ViewState("LineItems") = sw.ToString()
On the line xs.Serialize(sw, _Order), I get an error that reads:
The type LineItem was not expected. Use the XmlInclude or SoapInclude
attribute to specify types that are not known statically.
What am I missing?
Thanks,
Craig Buchanan