473,320 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

XML/SOAP Serilaiztion and Generic Collections

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
2 3766
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: xmail123 | last post by:
Hi, As was pointed out whatever you return from a WebMethod needs to be serializable to SOAP. An ArrayList is not serializable. I will be needing to return other data types from web methods. ...
2
by: Jasper Kent | last post by:
I'm trying to do the equivalent of using typedefs with templates in C++ to avoid long instantiation names. I can do this okay: using BigDictionary = System.Collections.Generic.Dictionary<int,...
3
by: KH | last post by:
I can't seem to figure this one out... I've searched MSDN and Goog, and made my best guesses to no avail,, so help would be much appreciated! public ref class T sealed : public...
1
by: raylopez99 | last post by:
I seem to get name collision between the Generic collection SortedList and C++.NET Framework collection SortedList. How to resolve? Here are the libraries that seem to clash:...
4
by: =?Utf-8?B?QkogU2FmZGll?= | last post by:
We have a class that has a public property that is of type List<T>. FXCop generates a DoNotExposeGenericLists error, indicating "System.Collections.Generic.List<Tis a generic collection designed...
2
by: Fred Heida | last post by:
Hi, i'm trying to (using managed C++) implment the IEnumerable<Tinterface on my class.. but have a problem with the 2 GetEnumerator method required.... what i have done is... ...
4
by: Sid Price | last post by:
Hello, I have a class of objects (Device) that are managed by another object (Devices) with a collection class (DeviceCollection) inherited from Collections.Hashtable. Each of the Device objects...
5
by: Michi Henning | last post by:
I can pass a generic collection as ICollection<Tjust fine: static void flatCollection(ICollection<intc) {} // ... List<intl = new List<int>(); flatCollection(l); // Works fine Now I...
2
by: SimonDotException | last post by:
I am trying to use reflection in a property of a base type to inspect the properties of an instance of a type which is derived from that base type, when the properties can themselves be instances of...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.