473,396 Members | 1,671 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,396 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

Nov 17 '05 #1
0 950

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

Similar topics

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: 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...
0
by: Kurt Ng | last post by:
Need help quick!!! Am really stuck on this problem! I have a C dll, and it uses a nested struct. (see below) The struct has 2 layers of nested structs. The first field in the first struct is...
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: 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"/>...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.