Click here to Skip to main content
15,911,531 members
Home / Discussions / C#
   

C#

 
QuestionObject as disctionary key Pin
AndrusM25-Jun-07 1:36
AndrusM25-Jun-07 1:36 
AnswerRe: Object as disctionary key Pin
originSH25-Jun-07 1:48
originSH25-Jun-07 1:48 
GeneralRe: Object as disctionary key Pin
AndrusM25-Jun-07 2:36
AndrusM25-Jun-07 2:36 
GeneralRe: Object as disctionary key Pin
Pete O'Hanlon25-Jun-07 3:01
mvePete O'Hanlon25-Jun-07 3:01 
GeneralRe: Object as disctionary key Pin
AndrusM25-Jun-07 3:16
AndrusM25-Jun-07 3:16 
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 
AndrusM wrote:
Different objects can have same hash codes so has code can used only in hash algoritms which check for object eqality if hash codes match.


Yes, but that is not the problem here. Your problem is that you have two objects that contains the same data, but as the hash code is calculated based on the reference, they will still have different hash codes. As the hash codes are different, it will never compare the objects, as two objects with different hash codes by definition can not be equal.

AndrusM wrote:
Is it simpler to use string as dictionary key and require that object key is string always ?
Will string comparison work by value in this sample ?


A string would work. Any type that implements GetHashCode based on the value instead of the reference would work.

---
single minded; short sighted; long gone;

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 
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 

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.