By modifying the value of a key, I assume you mean you want to change
a key of a key-value pair, leaving the value of the key-value pair the
same? You can't do that.
Remember, from MSDN Hashtable help:
"When an element is added to the Hashtable, the element is placed into
a bucket based on the hash code of the key"
So changing a key would require the element to go in a new bucket, and
there's no method to do this that I know of. Instead, you'll want to
create a new key-value pair with the same value of the old pair, and
remove the old pair.
something like (untested)
object temp = hashtable[oldkey];
hashtable.Remove(oldkey);
hashtable[newkey] = temp;
If you mean you want to change a value of a key-value pair, then this
is all you need:
hashtable[key] = newvalue;
mike