PC Review


Reply
Thread Tools Rate Thread

Customizing Hashtable, question 2

 
 
Philipp Schumann
Guest
Posts: n/a
 
      9th Apr 2005
Hi,

does anyone know whether the custom IComparer and IHashCodeProvider are used
for (a) keys only, (b) values only, (c) both?

(I'd prefer c to be the answer

Thanks,
Phil


 
Reply With Quote
 
 
 
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      9th Apr 2005
Philipp Schumann <(E-Mail Removed)> wrote:
> does anyone know whether the custom IComparer and IHashCodeProvider are used
> for (a) keys only, (b) values only, (c) both?
>
> (I'd prefer c to be the answer


a) - the values are never compared in a Hashtable. The point is to map
keys to values.

--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
 
Reply With Quote
 
Philipp Schumann
Guest
Posts: n/a
 
      9th Apr 2005
Hi Jon,

thanks---I was just wondering whether Hashtable.ContainsValue would
implicitly use one of the two, or both, thus I was hoping for (c) =)

Best,
Phil

"Jon Skeet [C# MVP]" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> Philipp Schumann <(E-Mail Removed)> wrote:
>> does anyone know whether the custom IComparer and IHashCodeProvider are
>> used
>> for (a) keys only, (b) values only, (c) both?
>>
>> (I'd prefer c to be the answer

>
> a) - the values are never compared in a Hashtable. The point is to map
> keys to values.
>
> --
> Jon Skeet - <(E-Mail Removed)>
> http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too



 
Reply With Quote
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      9th Apr 2005
Philipp Schumann <(E-Mail Removed)> wrote:
> thanks---I was just wondering whether Hashtable.ContainsValue would
> implicitly use one of the two, or both, thus I was hoping for (c) =)


Hashtable.ContainsValue has to walk through all the "buckets" looking
for the value, using object.Equals to check each bucket's value.

--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hashtable question Steve Microsoft ASP .NET 3 21st Aug 2006 08:49 PM
hashtable question Starbuck Microsoft VB .NET 3 14th Nov 2005 04:23 PM
Hashtable question. =?Utf-8?B?TmF2ZWVuIE11a2tlbGxp?= Microsoft C# .NET 7 10th Jul 2005 07:58 PM
Customizing Hashtable Philipp Schumann Microsoft Dot NET Framework 3 9th Apr 2005 08:56 PM
HashTable Question Jack Handy Microsoft Dot NET Framework Forms 3 5th Jun 2004 12:32 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:02 AM.