I have a class (UserAccount) that uses a List<T> to contain a collection of
Account classes. The Account class uses a List<T> to contain a collection of
the account items. If the Account class is a checking account its List<>
collection contains instances of the CheckItem class, which represents a
single register item in a checking account.
I would like to be able to use the three types of serialization on them. Of
course, the BinaryFormatter works fine. I tried to mark the List<> fields as
[SoapIgnore, XmlIgnore] and before XML or SOAP seriliazation create an Array
from it. However, the mere existence of the List<> class still causes XML
and SOAP seriliazation to fail, claiming that generics are not supported.
Is there a way I can use the generic List<> collection and still get XML and
SOAP serialization to work?
Thanks!
DXRick - 31 Mar 2007 04:36 GMT
Well, should I.....
1) Use an ArrayList instead?
2) Use a XMLWriter to create a XML version of the class's contents?
I do not intend to deserialize it, but rather to support XML and SOAP as
formats to export the data too.
Anyone????
TY
Joe Fawcett - 31 Mar 2007 08:04 GMT
There are two issues, firstly, as you say, the soap formatter cannot cope
with generics. Secondly you can still serialise to XML using XmlSerializer
directly.

Signature
Joe Fawcett (MVP - XML)
http://joe.fawcett.name
>I have a class (UserAccount) that uses a List<T> to contain a collection of
> Account classes. The Account class uses a List<T> to contain a collection
[quoted text clipped - 17 lines]
>
> Thanks!