GetHashCode() public method

public GetHashCode ( ) : int
return int
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Offset.GetHashCode();
         hashCode = hashCode * 31 + Length;
         if (Object != null)
         {
             hashCode = hashCode * 31 + Object.GetHashCode();
         }
         return(hashCode);
     }
 }
示例#2
0
 public static void Equals(UIntPtr ptr1, object obj, bool expected)
 {
     if (obj is UIntPtr)
     {
         UIntPtr ptr2 = (UIntPtr)obj;
         Assert.Equal(expected, ptr1 == ptr2);
         Assert.Equal(!expected, ptr1 != ptr2);
         Assert.Equal(expected, ptr1.GetHashCode().Equals(ptr2.GetHashCode()));
     }
     Assert.Equal(expected, ptr1.Equals(obj));
     Assert.Equal(ptr1.GetHashCode(), ptr1.GetHashCode());
 }
示例#3
0
 public static void GetHashCodeRespectAllBits()
 {
     var ptr1 = new UIntPtr(0x123456FFFFFFFF);
     var ptr2 = new UIntPtr(0x654321FFFFFFFF);
     Assert.NotEqual(ptr1.GetHashCode(), ptr2.GetHashCode());
 }
示例#4
0
 public override int GetHashCode()
 {
     return(_value.GetHashCode());
 }