473,811 Members | 2,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Storing string collection using Configuration Block

What is the easiest way to store a collection of strings using the MS
Configuration Block? I am using XML serializer. I tried having an ArrayList
as a property in the class I was serializing, but when it is read back it is
no longer an arraylist of string values. Any ideas?
Nov 16 '05 #1
2 4136
Each element of ArrayList is type of object. You can just do like...

foreach(string s in MyArrayList)
{
// do whatever you want here
}

Would that not work for you?

=============== =============
Hayato Iriumi (hi*****@hotmai l.com)
Blog: http://www.vbaspcoder.com

"gcrasher" <gc******@discu ssions.microsof t.com> wrote in message
news:6C******** *************** ***********@mic rosoft.com...
What is the easiest way to store a collection of strings using the MS
Configuration Block? I am using XML serializer. I tried having an ArrayList as a property in the class I was serializing, but when it is read back it is no longer an arraylist of string values. Any ideas?

Nov 16 '05 #2
I am using Micosofts Configuration block, which serializes objects to xml and
reads them back. When I serialize something that contains an array list and
then read it back like:

MyClass = (MyClass)Config urationManager. Read("section") ;

then MyClass.ArrayLi st no longer contains the string objects.


"Hayato Iriumi" wrote:
Each element of ArrayList is type of object. You can just do like...

foreach(string s in MyArrayList)
{
// do whatever you want here
}

Would that not work for you?

=============== =============
Hayato Iriumi (hi*****@hotmai l.com)
Blog: http://www.vbaspcoder.com

"gcrasher" <gc******@discu ssions.microsof t.com> wrote in message
news:6C******** *************** ***********@mic rosoft.com...
What is the easiest way to store a collection of strings using the MS
Configuration Block? I am using XML serializer. I tried having an

ArrayList
as a property in the class I was serializing, but when it is read back it

is
no longer an arraylist of string values. Any ideas?


Nov 16 '05 #3

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

Similar topics

10
11138
by: cppdev | last post by:
Hi All! I want to clear the string contents from sensitive information such as passwords, and etc. It's always a case that password will appear as string at some point or another. And i feel uneasy leaving it hanging in memory indefinitely (especially in case when string is Interned). So at leats for the case when string is not interned i propose:
10
3080
by: Diego F. | last post by:
Hello. I need to store custom objects in a SQL Server 2000 table. Which is the easiest way to do it? Do I need to write methods to store each attribute separately from C# app to the table and the opposite as well? Regards, Diego F.
4
1281
by: Claire | last post by:
Hi We're newish to visual studio .net. I wanted to store some user defined variables. Normally I'd have written these to the registry but my colleague informed me that Microsoft was trying to dissuade users away from the registry and towards configuration files. So I had a look at the System.Configuration.ConfigurationSettings.AppSettings object he told me about. Can this file be written on the fly? The only info Ive found about these...
1
1178
by: Philip Wagenaar | last post by:
Hi, I used the microsoft configuration block to store settings for applications in the past and this worked fine. But now I have the following situation and I do not know how to solve this: I want to write a windows service that stores its settings in a xml file using the configuration block. And I want to write a windows forms application that manages the service. Stop,start and modify the settings.
8
9460
by: rgparkins | last post by:
Hi I am creating a sign-up process on a web site much like that of a wizard form. I have browsed many sites to look for examples of how to store the entry data, so that the user can go back and forward along the sign -up process. I am currently trying to use a Session object to store all these details and get them back out of session as each step is selected. My model was a HashTable of NameValueCollection, so I could go to the hash...
9
1722
by: bonk | last post by:
Does anyone have a simple example on how to prohibit that any thread other than the current thread modifies a certain object (a collection) while we are in a certain section of the code? In other words: while we are inside this codeblock whoever might think of modified that particular collection has to wait until we have left that codeblock. As far as I understand it lock() {} only prohibits that other threads enter a certain block of...
9
2289
by: KarlM | last post by:
After reading some articles regarding confuguration data I'm a bit confused. Where is the right place for storing configuration data? - XML-files? - registry? - INI-files? (from a users point of view, ini-files are more comfortable to read and edit) Where should I store user specific config data? Where should I store machine specific config data?
11
10155
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I have worked with application settings in VS2005 and C# for awhile, but usually with standard types. I have been trying to store a custom container/class/type in an application setting and I have seen erratic results. I am aware of one known defect where user classes do not show up in the list of types on the Property/Settings page in the visual designer and I am wondering if I am encountering some other peculiar issue, or if there are...
158
7921
by: pushpakulkar | last post by:
Hi all, Is garbage collection possible in C++. It doesn't come as part of language support. Is there any specific reason for the same due to the way the language is designed. Or it is discouraged due to some specific reason. If someone can give inputs on the same, it will be of great help. Regards, Pushpa
0
10651
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10403
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10136
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5555
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5693
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4341
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3868
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3020
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.