Click here to Skip to main content
15,889,527 members
Home / Discussions / C#
   

C#

 
AnswerRe: Object as disctionary key Pin
Guffa25-Jun-07 4:05
Guffa25-Jun-07 4:05 
GeneralRe: Object as disctionary key Pin
AndrusM25-Jun-07 4:27
AndrusM25-Jun-07 4:27 
AnswerRe: Object as disctionary key Pin
Guffa25-Jun-07 7:51
Guffa25-Jun-07 7:51 
GeneralRe: Object as disctionary key Pin
AndrusM26-Jun-07 0:05
AndrusM26-Jun-07 0:05 
AnswerRe: Object as disctionary key Pin
Guffa26-Jun-07 2:13
Guffa26-Jun-07 2:13 
GeneralRe: Object as disctionary key Pin
AndrusM26-Jun-07 4:47
AndrusM26-Jun-07 4:47 
AnswerRe: Object as disctionary key Pin
Guffa26-Jun-07 6:08
Guffa26-Jun-07 6:08 
GeneralRe: Object as disctionary key Pin
originSH25-Jun-07 4:30
originSH25-Jun-07 4:30 
Hash codes are used for HashTables and Dictionaries, when a key is added the Hash code of the key is used to figure out which bucket the key should be stored in, this is how the searching for the key is speeded up.

http://msdn2.microsoft.com/en-us/library/4yh14awz.aspx[^]


Here is the exact code from the base class libary for when something is inserted into a dictionary:

int num = this.comparer.GetHashCode(key) & 0x7fffffff;
for (int i = this.buckets[num % this.buckets.Length]; i >= 0; i = this.entries[i].next)




AndrusM wrote:
In this case I can use string as distionary key and I think string comparison works OK .


Yes, using a string would work very well, but I thought you wanted to use your custom Key class?
GeneralRe: Object as disctionary key Pin
AndrusM25-Jun-07 5:31
AndrusM25-Jun-07 5:31 
GeneralRe: Object as disctionary key Pin
originSH25-Jun-07 5:45
originSH25-Jun-07 5:45 
QuestionThe modifier 'public' is not valid for this item. Pin
steffw25-Jun-07 1:35
steffw25-Jun-07 1:35 
AnswerRe: The modifier 'public' is not valid for this item. Pin
originSH25-Jun-07 1:52
originSH25-Jun-07 1:52 
GeneralRe: The modifier 'public' is not valid for this item. Pin
steffw25-Jun-07 2:54
steffw25-Jun-07 2:54 
AnswerRe: The modifier 'public' is not valid for this item. Pin
Guffa25-Jun-07 5:36
Guffa25-Jun-07 5:36 
Questiongetting id of row Pin
tauras8125-Jun-07 1:26
tauras8125-Jun-07 1:26 
AnswerRe: getting id of row Pin
Sathesh Sakthivel25-Jun-07 1:32
Sathesh Sakthivel25-Jun-07 1:32 
AnswerRe: getting id of row Pin
Revathij25-Jun-07 1:59
Revathij25-Jun-07 1:59 
QuestionHow to view a RPT file in my application Pin
i.rabek25-Jun-07 1:26
i.rabek25-Jun-07 1:26 
Questiongetting id of row Pin
tauras8125-Jun-07 1:23
tauras8125-Jun-07 1:23 
AnswerRe: getting id of row Pin
kubben25-Jun-07 2:07
kubben25-Jun-07 2:07 
QuestionCatch Dr.Watson Window Pin
realmontanakid25-Jun-07 1:13
realmontanakid25-Jun-07 1:13 
Questioncan u figure y dis xception is comin Pin
samreengr825-Jun-07 1:01
samreengr825-Jun-07 1:01 
AnswerRe: can u figure y dis xception is comin Pin
Luc Pattyn25-Jun-07 1:24
sitebuilderLuc Pattyn25-Jun-07 1:24 
GeneralRe: can u figure y dis xception is comin Pin
samreengr825-Jun-07 1:38
samreengr825-Jun-07 1:38 
AnswerRe: can u figure y dis xception is comin Pin
Pete O'Hanlon25-Jun-07 1:39
mvePete O'Hanlon25-Jun-07 1:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.