Click here to Skip to main content
16,006,341 members
Home / Discussions / C#
   

C#

 
GeneralRe: Import unmanaged C++ dll into C# project Pin
jamesmurphy7813-Oct-08 10:03
jamesmurphy7813-Oct-08 10:03 
GeneralRe: Import unmanaged C++ dll into C# project Pin
Mark Salsbery13-Oct-08 10:57
Mark Salsbery13-Oct-08 10:57 
GeneralRe: Import unmanaged C++ dll into C# project Pin
jamesmurphy7813-Oct-08 11:24
jamesmurphy7813-Oct-08 11:24 
GeneralRe: Import unmanaged C++ dll into C# project Pin
Mark Salsbery13-Oct-08 11:33
Mark Salsbery13-Oct-08 11:33 
GeneralRe: Import unmanaged C++ dll into C# project Pin
jamesmurphy7813-Oct-08 11:53
jamesmurphy7813-Oct-08 11:53 
GeneralRe: Import unmanaged C++ dll into C# project Pin
Mark Salsbery13-Oct-08 12:04
Mark Salsbery13-Oct-08 12:04 
QuestionGetHashCode implementation Pin
DaveyM6910-Oct-08 11:45
professionalDaveyM6910-Oct-08 11:45 
AnswerRe: GetHashCode implementation Pin
Guffa10-Oct-08 12:26
Guffa10-Oct-08 12:26 
The only strict requirement for the GetHashCode method is that it should always return the same hash code for a given value. So, this is a valid implementation of the method:
public override int GetHashCode() {
   return 0;
}

However, that gives bad performance when you use the hash code for example in a dictionary. For good performance, the hash codes should be evenly distributed over the Int32 range of values.

This is how the implementation looks for the Int32 type:
public override int GetHashCode() {
   return this;
}

This is how the implementation looks for the Int64 type:
public override int GetHashCode() {
   return ((int)this) ^ ((int)(this >> 0x20));
}

As you see, it just throws away the top 12 bits. If you want to use all the bits in the hash code, you can just do an xor of the upper and lower value:
public override int GetHashCode() {
   return m_Upper ^ m_Lower;
}


Despite everything, the person most likely to be fooling you next is yourself.

GeneralRe: GetHashCode implementation Pin
DaveyM6910-Oct-08 12:54
professionalDaveyM6910-Oct-08 12:54 
GeneralRe: GetHashCode implementation Pin
DaveyM6910-Oct-08 13:05
professionalDaveyM6910-Oct-08 13:05 
GeneralRe: GetHashCode implementation Pin
Guffa10-Oct-08 14:09
Guffa10-Oct-08 14:09 
QuestionFinding in datagridview Pin
ArielR10-Oct-08 11:43
ArielR10-Oct-08 11:43 
AnswerRe: Finding in datagridview Pin
Pedram Behroozi10-Oct-08 12:21
Pedram Behroozi10-Oct-08 12:21 
AnswerRe: Finding in datagridview Pin
nelsonpaixao10-Oct-08 12:38
nelsonpaixao10-Oct-08 12:38 
AnswerRe: Finding in datagridview Pin
Wendelius10-Oct-08 22:01
mentorWendelius10-Oct-08 22:01 
Questionform_load and performclick() Pin
Saamir10-Oct-08 10:46
Saamir10-Oct-08 10:46 
AnswerRe: form_load and performclick() Pin
vineas10-Oct-08 11:03
vineas10-Oct-08 11:03 
GeneralRe: form_load and performclick() Pin
Saamir13-Oct-08 4:43
Saamir13-Oct-08 4:43 
AnswerRe: form_load and performclick() Pin
Pedram Behroozi10-Oct-08 11:04
Pedram Behroozi10-Oct-08 11:04 
GeneralRe: form_load and performclick() Pin
Saamir10-Oct-08 11:06
Saamir10-Oct-08 11:06 
GeneralRe: form_load and performclick() Pin
Pedram Behroozi10-Oct-08 11:12
Pedram Behroozi10-Oct-08 11:12 
GeneralRe: form_load and performclick() Pin
DaveyM6910-Oct-08 11:26
professionalDaveyM6910-Oct-08 11:26 
GeneralRe: form_load and performclick() Pin
Saamir13-Oct-08 4:44
Saamir13-Oct-08 4:44 
AnswerRe: form_load and performclick() Pin
Dave Kreskowiak10-Oct-08 11:29
mveDave Kreskowiak10-Oct-08 11:29 
GeneralRe: form_load and performclick() Pin
Saamir13-Oct-08 4:42
Saamir13-Oct-08 4:42 

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.