473,236 Members | 1,330 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,236 software developers and data experts.

Configuration Library - Nested structs/ArrayLists

Hello everyone,

I am using the Configuration Application block to write an XML
configuration file for my application. Most of it is working fine but I
have a problem serialising some nested structs that have arraylist
fields. What I want to do is to have a ShoppingBasket that will hold
any number of Itemstructs and an AllShoppingBaskets that will hold all
the ShoppingBaskets. The resulting XML I am after should look like
this.

<AllShoppingBaskets>
<ShoppingBasket>
<Item>
<ItemType>ItemType</ItemType>
<ItemCaption>ItemCaption</ItemCaption>
</Item>
</ShoppingBasket >
</AllShoppingBaskets >

To do this I created
- an Item struct:
public struct Item
{
public Item(string itemType, string itemCaption)...
}

- a ShoppingBasket struct:
public struct ShoppingBasket
{
public ShoppingBasket (ArrayList items)...
}
the items Arraylist will hold all the items of the basket.

- and an AllShopingBasket struct.
public struct Stations
{
public Stations (ArrayList allBaskets)...
}
the allBaskets Arraylist will hold all the ShoppingBaskets where every
basket will hold Items.

to serialise the data I am using :
ConfigurationManager.WriteConfiguration("shoppingb asketsettings",
configData);
So in the ConfigData Class I have an AllShopingBaskets property to be
serialized this way I would get

<AllShoppingBaskets>
<AllBaskets>
<anyType xsi:type="ShoppingBasket">
<Items>
<anyType xsi:type="Item">
<ItemType>ItemType</ItemType>
<ItemCaption>ItemCaption</ItemCaption>
</anyType>
</Items>
</anyType>
</AllBaskets>
</AllShoppingBaskets>

But if I have to have an Item and a ShoppingBasket as properties in the
ConfigData class or else I get an XML exception. If I do have those two
I get the above XML but also XML representations of Items and
ShopingBaskets which I don't want. If I use [XMLIgnore] on them it
breaks again.

Any ideas on what I am doing wrong or suggestion on doing this in a
different way?

Cheers

Jul 21 '05 #1
0 1082

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

Similar topics

0
by: Magne Ryholt | last post by:
Have a class with a public property named "TheFirstPropertyOfArrayListType" of type ArrayList, property has attribute XmlElement to describe the contents of the ArrayList, the contents is a public...
10
by: nimmi_srivastav | last post by:
Below you will see an example of a nested conditional expression that this colleague of mine loves. He claims that it is more efficient that a multi-level if-else-if structure. Moreover, our...
4
by: Christopher Ireland | last post by:
Hi -- I'm trying to find an example of a nested class implemented within the .NET Framework itself but without much success. I don't suppose that anybody knows of such an example off the top of...
4
by: MSDousti | last post by:
Hi all, I read some Q&As in the Net, discussing Marshalization of nested structs in C# (or VB.NET). Some guys stated that .NET framework does not support this feature yet. Are they right? ...
0
by: Alexandros__ | last post by:
Hello everyone, I am using the Configuration Application block to write an XML configuration file for my application. Most of it is working fine but I have a problem serialising some nested...
0
by: phillip | last post by:
This is interesting, I have attached my web.config file and the exception I have been logging. I created a library which provide data access to a database and a control system. The library is...
5
by: Macca | last post by:
Hi, I have a number of queue structures. I want to have multiple instances of these, i.e Instance 1 Instance 2 Instance 3 ... ------------ ------------ ...
3
by: garyusenet | last post by:
Hi, As I continue to explore C# , Visual Studio, and Programming in general I am becoming increasingly hooked. I see myself definately studying and learning c# with visual studio over the next...
1
by: =?Utf-8?B?RGljaw==?= | last post by:
My Windows Application stores its configuration values in app.config and these are typed and accessed via corresponding classes, something like this... <configSections> <section name="Watcher"/>...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
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...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.