473,401 Members | 2,125 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,401 software developers and data experts.

Collection classes question

I have a set of parameter names and values (essentially key/value pairs)
that I'm reading from a DB. I need to temporarily store these pairs so that
I can later format them an write them to a file. I will not need to look up
values in the collection - just reading them in and sptting them back out
sequentially. This leads me to believe that a HashTable isn't what I need.
Hmm...just found an exaply using a Dictionary and an Enumerator to traverse
it. Is this the best solution?

Thanks in advance,
Will.
Nov 15 '05 #1
3 1173
There is probably some unnecessary overhead there. If you know how many
items you'll have, just create a two-dimensional array. If it varies, create
an ArrayList.

$0.02

"Will" <de*@rusmo.com> wrote in message
news:1o********************@giganews.com...
I have a set of parameter names and values (essentially key/value pairs)
that I'm reading from a DB. I need to temporarily store these pairs so that I can later format them an write them to a file. I will not need to look up values in the collection - just reading them in and sptting them back out
sequentially. This leads me to believe that a HashTable isn't what I need. Hmm...just found an exaply using a Dictionary and an Enumerator to traverse it. Is this the best solution?

Thanks in advance,
Will.

Nov 15 '05 #2
100
Hi Will,
Why Hastable doesn't work for you? There is no Dictionary class. Hastable is
the dictionary.
There is DictionaryBase class as well, which is meant to be used for making
strongly-typed hashtables.
If you want to traverse all data in the hashtable you can use Values
property. if you want to traverse and read all key/value pairs you can do

foreach(DictionaryEntry de in hastable)
{
//de.Key is the key;
//de.Value is the value;
}

HTH
B\rgds
100

"Will" <de*@rusmo.com> wrote in message
news:1o********************@giganews.com...
I have a set of parameter names and values (essentially key/value pairs)
that I'm reading from a DB. I need to temporarily store these pairs so that I can later format them an write them to a file. I will not need to look up values in the collection - just reading them in and sptting them back out
sequentially. This leads me to believe that a HashTable isn't what I need. Hmm...just found an exaply using a Dictionary and an Enumerator to traverse it. Is this the best solution?

Thanks in advance,
Will.

Nov 15 '05 #3
Thanks guys...I decided on an ArrayList of DictionaryEntry's, which works
fine and seems logical to me.

Will.
Nov 15 '05 #4

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

Similar topics

9
by: Project2501a | last post by:
hey guys, Question about the internal workings of Access. How are controls added in the Form.Controls collection? I mean, in which order? the order place them on the form? is there a way to...
10
by: Mart | last post by:
What class does everyone out there use if they want to store a set of values efficiently? In java I use a HashSet, but there is no equivalent in C#. Even worse, the lowest level interface to...
3
by: JJ | last post by:
Hi, I noticed in a sample app source code that the app made use of a class for example a user class and then had the user objects that got created stuffed into a user collection. I was wondering...
2
by: kermit | last post by:
I have an .net aspx page MyPage.aspx (client side), with code behind MyPage.aspx.vb (server side) I use the pages server On_Load event (.aspx.vb) to create a collection using classes. ...
16
by: Ben Hannon | last post by:
Hi, I'm writting a COM Class in VB.NET to be used in a VB6 project (Tired of the VB6 hassles with cloning and serializing an object). All my classes I need cloneable/serializable are now in a...
1
by: Sam Marrocco | last post by:
Does anyone know of any third-party collections classes, dotnet compatible and *serializable*, that would be much faster than the legacy collection or dotnet collection-type classes? --...
2
by: Ivan Weiss | last post by:
Hi. This is a question I have posted before and have never figured out a working result. I have been recommended to read some books which I did which still have not answered my question. I am...
6
by: Jack | last post by:
Hello everyone, Just a general question. Is the Collection Object a dinosaur from VB6 with another more useful object preferred for VB.NET? Or, has its stature remained unchanged with .NET? ...
3
by: Dave | last post by:
Please - anyone that can help. I am getting confusing results while trying to expose a collection from a web service. I have a webservice in which a web method accepts a collection as a...
19
by: Jamey Shuemaker | last post by:
I'm in the process of expanding my knowledge and use of Class Modules. I've perused MSDN and this and other sites, and I'm pretty comfortable with my understanding of Class Modules with the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.