By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,362 Members | 3,489 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,362 IT Pros & Developers. It's quick & easy.

XML/SOAP Serilaiztion and Generic Collections

P: n/a
I have a class (UserAccount) that uses a List<Tto contain a collection of
Account classes. The Account class uses a List<Tto 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!

Mar 29 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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

Mar 31 '07 #2

P: n/a
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.

--

Joe Fawcett (MVP - XML)
http://joe.fawcett.name

"DXRick" <DX****@discussions.microsoft.comwrote in message
news:BF**********************************@microsof t.com...
>I have a class (UserAccount) that uses a List<Tto contain a collection of
Account classes. The Account class uses a List<Tto 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!

Mar 31 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.