GetHashCode() public method

public GetHashCode ( ) : int
return int
コード例 #1
0
 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
ファイル: UIntPtrTests.cs プロジェクト: geoffkizer/corefx
 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
ファイル: UIntPtrTests.cs プロジェクト: geoffkizer/corefx
 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());
 }