Array/collection

  • Thread starter Thread starter joe
  • Start date Start date
J

joe

I am trying to track counts of values - I guess an 2-dimn array would be the
way to go?

Basically I want a string in the first position and an integer in the
second:

"This strValue", 5
"That strValue", 21
"Other strValue", 2
....

and i don't know what the values are, nor how many values there will be, so
the array will have to grow as I process the incoming data.

I also need to grab a value from my data stream, look it up in this array,
if its there, bump the value by one - if its not here, grow the array and
put a one to the value.

I'm trying to find out if this should be done in an array, a collection?, or
other.

From searching and reviewing all the sample code out there is confusing me I
guess.

Any help appreciated. Thanks, joe
 
Thanks Daniel, this looks real promising.

I have figured out how to add my key/value pairs, how to display them later
(like that was tough to figure out with the help files) and how to lookup a
given key to verify that it exists.

But to update the counter each time its found, I'm not seeing. Does the Add
method search for a dup and allow an update if it does indeed exist? I
can't seem to find an answer to this one.

Thanks again!
 
HastTables can't be sorted ... doesn't appear that SortedList is supported
in the CF. How can I get around this? I need to display my key/values in
key-sorted order.
 
For sorting there is a similar thread in the archives. Check it out:http://groups.google.com/groups?hl=en&lr=&c2coff=1&th=ca88bbdbb1ae9218&rnum=1

Yes, I have been reviewing that thread and the accompanying codeproject
articles. But wow, just to sort a list that was a lot of stuff. I
digressed into basically what you lead me to below; testing it now. Maybe
this is exactly what the articles were talking about, but if so, he sure
took a round about way of explaining it (or maybe I'm slow on this sunday
afternoon -more probable).
I would retrieve the Keys, sort them, and then iterate over the sorted keys
retrieving items from the hashtable.

Thanks Daniel, I think I got 'er working now. Much appreciated.
 
Back
Top