473,320 Members | 1,744 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 Serialization of ArrayLists in Managed C++

Hi,

I'm trying to use XmlSerialization (C++ .NET) for ArrayLists and am getting
frustrated! I'd appreaciate any explanations (the ones I found on google so
far didn't do it for me).

Here's my example :
public __gc class ServerConfig
public:
ServerConfig(void)
{
}

__property String* get_Description(){return description;};
__property String* get_Database(){return database;};
__property String* get_Hostname(){return hostname;};
__property String* get_ConnectionType(){return connectiontype;};

private :

String* description;
String* database;
String* hostname;
String* connectiontype;

};

and elsewhere I have an Arraylist containing ServerConfigs and would like to
serialize it :

ArrayList* srvCol = new ArrayList();
// some code to load the arraylist with ServerConfig items

How do I serialize the arraylist ? I tried variations around :

Type extraTypes[] = new Type[1];
extraTypes[0] = typeof(ServerConfig*);
XmlSerializer* ConfSerializer = new XmlSerializer(alSrvCol->GetType(),
extraTypes);

but keep getting compile errors such as :
1- C2691 System::Type invalid for __gc array element
2- C3861 typeof : identifier not found

Many thanks,

Oct 14 '05 #1
0 1175

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Christopher Pragash | last post by:
Hello All, I'm trying to use XML Serialization to a class that inherits from another class and also has ArrayLists exposed as properties. When I serialize the class after populating the methods...
3
by: Franz | last post by:
Let me describe the flow of my program first. 1. Deserialize data from xml file. 2. Addition of "PersonType" class to the AllPersonalData. 3. Serialize data back to the xml file. My question is...
1
by: Jax | last post by:
I have a rather large class that i'm looking to serialize to Xml. Whenever it tries to serialize it I get this error message: An unhandled exception of type 'System.InvalidOperationException'...
2
by: Just D | last post by:
Hi, I need to write a serialization (to XML string) and restoring (from XML string) of a very complicated object. The object uses a few classes, one class has two ArrayLists, etc. The general...
2
by: Steven | last post by:
Hello, In my asp.net application, I have the MainForm.aspx.cs (where all the functions are defined) and ClasssificationInfo.cs class. This is the Classification Info class -- using System;...
0
by: Meta-Meta | last post by:
Hi, I'm trying to use XmlSerialization (C++ .NET) for ArrayLists and am getting frustrated! I'd appreaciate any explanations (the ones I found on google so far didn't do it for me). Here's my...
15
by: Herby | last post by:
This is a follow on from my previous thread about clr/safe and STL.NET ...
15
by: Jacques | last post by:
Hi I am an dotNet newby, so pardon my ignorance. I am looking for a method of saving/copying a managed class to a stream/file WITHOUT saving the object's state, eg. if I have a ref class with...
1
by: CH | last post by:
Hy, Is custom serialization a must for unmanaged classes? Is there an easier way? Thank you. Dan Ionut Fechete
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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)...
1
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....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.