c# - When implementing IEqualityComparer.GetHashCode(T obj), can I use the current instance's state, or do I have to use obj? -


How do I implement IEqualityComparer, has a parameter for GetHashCode (T obj)? This is definitely not a stable object, so why can not I just use the current example to generate the hash code? I am curious because I am trying to do this:

  Public Abstract Class BaseClass: IEqualityComparer & LT; BaseClass & gt; {Public abstract int GetHashCode (BaseClass obj); } Public Category DerivedClass: Base Class {public int MyData; Public override int gatehashcode (baseclus obje) {MyData.GetHashCode (); // or I have to do this: // Return (DerivedClass) obj.MyData.GetHashCode (); }}   

I am trying to stop the artists because it is actually being used in high-performance code.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -