public override int GetHashCode() { var hashCode = 291051517; hashCode = hashCode * -1521134295 + Int.GetHashCode(); hashCode = hashCode * -1521134295 + Long.GetHashCode(); hashCode = hashCode * -1521134295 + Short.GetHashCode(); hashCode = hashCode * -1521134295 + UInt.GetHashCode(); hashCode = hashCode * -1521134295 + ULong.GetHashCode(); hashCode = hashCode * -1521134295 + UShort.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <int?> .Default.GetHashCode(NullableInt); hashCode = hashCode * -1521134295 + Byte.GetHashCode(); hashCode = hashCode * -1521134295 + SByte.GetHashCode(); hashCode = hashCode * -1521134295 + Bool.GetHashCode(); hashCode = hashCode * -1521134295 + Float.GetHashCode(); hashCode = hashCode * -1521134295 + Double.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <byte[]> .Default.GetHashCode(ByteArray); hashCode = hashCode * -1521134295 + Decimal.GetHashCode(); hashCode = hashCode * -1521134295 + DateTime.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(String); return(hashCode); }
public static void TestGetHashCode() { SByte i1 = 123; SByte i2 = 65; Assert.NotEqual(0, i1.GetHashCode()); Assert.NotEqual(i1.GetHashCode(), i2.GetHashCode()); }
public void TestGetHashCode() { try { MySByte1.GetHashCode(); MySByte2.GetHashCode(); MySByte3.GetHashCode(); } catch { Assert.Fail("GetHashCode should not raise an exception here"); } }
public Boolean runTest() { int iCountTestcases = 0; int iCountErrors = 0; Console.Error.WriteLine(strName + ": " + strTest + " runTest started..."); for (SByte i = -10; i < 10; ++i) { iCountTestcases++; if (i.GetHashCode() < 0) { iCountErrors++; print("E_vfr4"); Console.Error.WriteLine(" SByte.GetHashCode() == " + i.GetHashCode() + " which is less then zero"); } for (SByte j = -10; j < i; ++j) { if (i.GetHashCode() == j.GetHashCode()) { iCountErrors++; print("E_vff4"); Console.Error.WriteLine(i + ".GetHashCode() == " + i.GetHashCode() + " which is the same as " + j + ".GetHashCode() == " + j.GetHashCode()); } } } SByte sTest = SByte.MinValue; if (sTest.GetHashCode() < 0) { iCountErrors++; print("E_vvr4"); Console.Error.WriteLine(" SByte.GetHashCode() == " + sTest.GetHashCode() + " which is less then zero"); } sTest = SByte.MaxValue; if (sTest.GetHashCode() < 0) { iCountErrors++; print("E_vvr4"); Console.Error.WriteLine(" SByte.GetHashCode() == " + sTest.GetHashCode() + " which is less then zero"); } if (iCountErrors == 0) { Console.Error.WriteLine("paSs. " + strTest + " iCountTestCases == " + iCountTestcases); return(true); } else { Console.Error.WriteLine("FAiL. " + strTest + " iCountErrors==" + iCountErrors); return(false); } }
public override int GetHashCode() { unchecked { var hashCode = Byte.GetHashCode(); hashCode = (hashCode * 397) ^ SByte.GetHashCode(); hashCode = (hashCode * 397) ^ Short.GetHashCode(); hashCode = (hashCode * 397) ^ UShort.GetHashCode(); hashCode = (hashCode * 397) ^ Int.GetHashCode(); hashCode = (hashCode * 397) ^ UInt.GetHashCode(); hashCode = (hashCode * 397) ^ Long.GetHashCode(); hashCode = (hashCode * 397) ^ ULong.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { unchecked { var hashCode = (Byte != null ? Byte.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (SByte != null ? SByte.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Short != null ? Short.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (UShort != null ? UShort.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Int != null ? Int.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (UInt != null ? UInt.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Long != null ? Long.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ULong != null ? ULong.GetHashCode() : 0); return(hashCode); } }
public override int GetHashCode() { unchecked { int hashCode = SByte.GetHashCode(); hashCode = (hashCode * 397) ^ Byte.GetHashCode(); hashCode = (hashCode * 397) ^ Int16.GetHashCode(); hashCode = (hashCode * 397) ^ UInt16.GetHashCode(); hashCode = (hashCode * 397) ^ Int32; hashCode = (hashCode * 397) ^ (int)UInt32; hashCode = (hashCode * 397) ^ Int64.GetHashCode(); hashCode = (hashCode * 397) ^ UInt64.GetHashCode(); hashCode = (hashCode * 397) ^ Single.GetHashCode(); hashCode = (hashCode * 397) ^ Double.GetHashCode(); hashCode = (hashCode * 397) ^ Decimal.GetHashCode(); hashCode = (hashCode * 397) ^ Char.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { unchecked { var hashCode = Byte.GetHashCode(); hashCode = (hashCode * 397) ^ SByte.GetHashCode(); hashCode = (hashCode * 397) ^ Short.GetHashCode(); hashCode = (hashCode * 397) ^ UShort.GetHashCode(); hashCode = (hashCode * 397) ^ Int; hashCode = (hashCode * 397) ^ (int)UInt; hashCode = (hashCode * 397) ^ Long.GetHashCode(); hashCode = (hashCode * 397) ^ ULong.GetHashCode(); hashCode = (hashCode * 397) ^ Float.GetHashCode(); hashCode = (hashCode * 397) ^ Double.GetHashCode(); hashCode = (hashCode * 397) ^ Decimal.GetHashCode(); hashCode = (hashCode * 397) ^ Guid.GetHashCode(); hashCode = (hashCode * 397) ^ String.GetHashCode(); hashCode = (hashCode * 397) ^ Key.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { unchecked { int hashCode = Bool.GetHashCode(); hashCode = (hashCode * 397) ^ Byte.GetHashCode(); hashCode = (hashCode * 397) ^ Character.GetHashCode(); hashCode = (hashCode * 397) ^ Decimal.GetHashCode(); hashCode = (hashCode * 397) ^ Double.GetHashCode(); hashCode = (hashCode * 397) ^ Float.GetHashCode(); hashCode = (hashCode * 397) ^ Int; hashCode = (hashCode * 397) ^ Long.GetHashCode(); hashCode = (hashCode * 397) ^ SByte.GetHashCode(); hashCode = (hashCode * 397) ^ Short.GetHashCode(); hashCode = (hashCode * 397) ^ (String != null ? String.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (int)UInt; hashCode = (hashCode * 397) ^ UShort.GetHashCode(); hashCode = (hashCode * 397) ^ ULong.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { unchecked { int hashCode = BooleanFalse.GetHashCode(); hashCode = (hashCode * 397) ^ BooleanTrue.GetHashCode(); hashCode = (hashCode * 397) ^ Char.GetHashCode(); hashCode = (hashCode * 397) ^ SByte.GetHashCode(); hashCode = (hashCode * 397) ^ Byte.GetHashCode(); hashCode = (hashCode * 397) ^ Int16.GetHashCode(); hashCode = (hashCode * 397) ^ UInt16.GetHashCode(); hashCode = (hashCode * 397) ^ Int32; hashCode = (hashCode * 397) ^ (int)UInt32; hashCode = (hashCode * 397) ^ Int64.GetHashCode(); hashCode = (hashCode * 397) ^ UInt64.GetHashCode(); hashCode = (hashCode * 397) ^ Single.GetHashCode(); hashCode = (hashCode * 397) ^ Double.GetHashCode(); hashCode = (hashCode * 397) ^ Decimal.GetHashCode(); hashCode = (hashCode * 397) ^ String.GetHashCode(); hashCode = (hashCode * 397) ^ DateTime.GetHashCode(); hashCode = (hashCode * 397) ^ DateTimeOffset.GetHashCode(); hashCode = (hashCode * 397) ^ Guid.GetHashCode(); hashCode = (hashCode * 397) ^ NonGenericType.GetHashCode(); hashCode = (hashCode * 397) ^ GenericTypeDefinition.GetHashCode(); hashCode = (hashCode * 397) ^ ClosedConstructedGenericType.GetHashCode(); hashCode = (hashCode * 397) ^ (NullReference != null ? NullReference.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Enum_S8.GetHashCode(); hashCode = (hashCode * 397) ^ Enum_U8.GetHashCode(); hashCode = (hashCode * 397) ^ Enum_S16.GetHashCode(); hashCode = (hashCode * 397) ^ Enum_U16.GetHashCode(); hashCode = (hashCode * 397) ^ Enum_S32.GetHashCode(); hashCode = (hashCode * 397) ^ Enum_U32.GetHashCode(); hashCode = (hashCode * 397) ^ Enum_S64.GetHashCode(); hashCode = (hashCode * 397) ^ Enum_U64.GetHashCode(); hashCode = (hashCode * 397) ^ SerializableObject.GetHashCode(); hashCode = (hashCode * 397) ^ ByteArrayEqualityComparer.GetHashCode(Buffer1); hashCode = (hashCode * 397) ^ ByteArrayEqualityComparer.GetHashCode(Buffer2); return(hashCode); } }
public override int GetHashCode() { unchecked { var hashCode = Boolean.GetHashCode(); hashCode = (hashCode * 397) ^ NullableBoolean.GetHashCode(); hashCode = (hashCode * 397) ^ Byte.GetHashCode(); hashCode = (hashCode * 397) ^ NullableByte.GetHashCode(); hashCode = (hashCode * 397) ^ SByte.GetHashCode(); hashCode = (hashCode * 397) ^ NullableSByte.GetHashCode(); hashCode = (hashCode * 397) ^ Char.GetHashCode(); hashCode = (hashCode * 397) ^ NullableChar.GetHashCode(); hashCode = (hashCode * 397) ^ Decimal.GetHashCode(); hashCode = (hashCode * 397) ^ NullableDecimal.GetHashCode(); hashCode = (hashCode * 397) ^ Double.GetHashCode(); hashCode = (hashCode * 397) ^ NullableDouble.GetHashCode(); hashCode = (hashCode * 397) ^ Single.GetHashCode(); hashCode = (hashCode * 397) ^ NullableSingle.GetHashCode(); hashCode = (hashCode * 397) ^ Int32; hashCode = (hashCode * 397) ^ NullableInt32.GetHashCode(); hashCode = (hashCode * 397) ^ (int)UInt32; hashCode = (hashCode * 397) ^ NullableUInt32.GetHashCode(); hashCode = (hashCode * 397) ^ Int64.GetHashCode(); hashCode = (hashCode * 397) ^ NullableInt64.GetHashCode(); hashCode = (hashCode * 397) ^ UInt64.GetHashCode(); hashCode = (hashCode * 397) ^ NullableUInt64.GetHashCode(); hashCode = (hashCode * 397) ^ Int16.GetHashCode(); hashCode = (hashCode * 397) ^ NullableInt16.GetHashCode(); hashCode = (hashCode * 397) ^ UInt16.GetHashCode(); hashCode = (hashCode * 397) ^ NullableUInt16.GetHashCode(); hashCode = (hashCode * 397) ^ (int)Enum; hashCode = (hashCode * 397) ^ NullableEnum.GetHashCode(); hashCode = (hashCode * 397) ^ (String != null ? String.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Nested != null ? Nested.GetHashCode() : 0); return(hashCode); } }
public override int GetHashCode() { return(val.GetHashCode()); }
public override int GetHashCode() => value.GetHashCode();
/// <summary> /// Returns a hash code for this instance. /// </summary> /// <returns> /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// </returns> public override int GetHashCode() { return(_value.GetHashCode()); }