Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

Dim R2 As NameValueCollection

 

How do I add integer in R2 ?

Edited by DR00ME

"Everything should be made as simple as possible, but not simpler."

"It's not that I'm so smart , it's just that I stay with problems longer ."

- Albert Einstein

  • *Experts*
Posted
Convert the integer to a string using its ToString() method or the Convert class and its ToString method. You might want to look at a HashTable rather than nameValueCollection for anything else than strings.
  • *Experts*
Posted

Im not really sure if im following the code you gave me as I have no idea what its suppoded to do, but from what I see HashTable will work. HashTable is a Key/Object collection too.

[edit]You just edited your post, Ill reread it :)[/edit]

[edit]Ah I see now. So basically you are setting a number as key and the count as the value. HashTable is perfect for that kind of job.[/edit]

Posted (edited)
I think hashtable is not useful for my needs because it doesnt got a method to count how many times a specific key/value occurs in it or does it ? Edited by DR00ME

"Everything should be made as simple as possible, but not simpler."

"It's not that I'm so smart , it's just that I stay with problems longer ."

- Albert Einstein

  • *Experts*
Posted

Same key cannot be added to a HashTable more than once.

 

Btw. don't make converting this to a hashtable a big priority in your program. NameValueCollection accepts strings. Integers are easily converted from/to strings so that will work too. But NameValueCollection wont work for other objects which you can't really convert to string and have a good result from it. I suggested this from a habit of using collections that fit the right object. I probably misunderstood your design too, so I might be totally off here.

Posted (edited)

ok there is a bug in my (actually not mine it is quoted from heiko) code so just forget it(I have also removed the code).... only thing im just trying to find out is how to calculate how many times a specific integer appears in some thing. This thing could be array,list,collection or something.

 

I dont want to do 2 x for loops if I use an array to find out which int occur most. Does anyone know if there is a collection/list/something which contains a method for calculating occurance ?

Edited by DR00ME

"Everything should be made as simple as possible, but not simpler."

"It's not that I'm so smart , it's just that I stay with problems longer ."

- Albert Einstein

Posted
Nevermind. Thx everyone who tried. I don't need it anymore it is too heavy for CPU I found a way to go around it.

"Everything should be made as simple as possible, but not simpler."

"It's not that I'm so smart , it's just that I stay with problems longer ."

- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...