HighTechTalks DotNet Forums  

Hashtable: setting a value?

Dotnet Academic General Discussions microsoft.public.dotnet.academic


Discuss Hashtable: setting a value? in the Dotnet Academic General Discussions forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
BCM
 
Posts: n/a

Default Hashtable: setting a value? - 08-12-2004 , 08:47 AM






How do you reset a value for an existing key in a hashtable? I need to
create a collection and compare the values with another collection: when
certain parameters are met then I need to reset the value of certain
elelments in the first collection.

I would have thought that the Hashtable.Item property would do the
trick, as MSDN defines it as "Gets or sets the value associated with the
specified key". But the actual documentation is so obtuse it's just silly:

http://msdn.microsoft.com/library/de...sitemtopic.asp

Thanks in advance.

Reply With Quote
  #2  
Old   
Peter van der Goes
 
Posts: n/a

Default Re: Hashtable: setting a value? - 08-12-2004 , 09:14 AM







"BCM" <BCM (AT) email (DOT) none> wrote

Quote:
How do you reset a value for an existing key in a hashtable? I need to
create a collection and compare the values with another collection: when
certain parameters are met then I need to reset the value of certain
elelments in the first collection.

I would have thought that the Hashtable.Item property would do the
trick, as MSDN defines it as "Gets or sets the value associated with the
specified key". But the actual documentation is so obtuse it's just silly:


http://msdn.microsoft.com/library/de...sitemtopic.asp

Thanks in advance.
Perhaps this example from John Skeet will help:
<quote>
It's an indexer - you need to use the indexer syntax:

Hashtable foo = new Hashtable();

foo["hello"]="there"; // Effectively foo.set_Item("hello", "there")
Console.WriteLine (foo["hello"]); // Using foo.get_Item("hello")
<unquote>

--
Peter [MVP Visual Developer]
Jack of all trades, master of none.





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.