![]() |
IOBit Software
|
|
|
||||||
| Programming Place to discuss programming including HTML, Java, C++, MySQL and others. |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
||||
|
||||
|
How To Modify An Element in the Dictionary Class?
======================================= C# has this cool Dictionary class that you can use like a Hash Table. Is there a way of changing the value of an indexed element without resorting to removing it like this? Code:
int value = runningcount[city];
runningcount.Remove(city);
runningcount.Add(city, ++value);
|
| Sponsored links |
|
|
|
#2
|
||||
|
||||
|
I haven't tried this, but according to http://msdn.microsoft.com/en-us/library/9tee9ht2.aspx you can probably use
Code:
runningcount[city]++; Quote:
__________________
I.think(code); I.eat(code.spaghetti); |
|
#3
|
||||
|
||||
|
Sweet.
I have a follow-up question to post in another thread. Here: http://forums.majorgeeks.com/showthr...41#post1764541 |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| modify the modify date on a file? | maxdamage | Software | 2 | 01-10-12 15:26 |
| Heaviest Element Known to Man | evilfantasy | Lounge | 11 | 03-03-09 12:05 |
| table element within a textarea | be0 | Programming | 9 | 07-25-08 11:47 |
| XML Newbie Has Element Error | babochka | Programming | 0 | 03-28-05 16:40 |
| java applet "Class <class name> not found" | jmlady | Programming | 0 | 06-16-04 14:25 |