コード例 #1
0
    public static void TestGetHashCode()
    {
        UInt16 i1 = 123;
        UInt16 i2 = 654;

        Assert.NotEqual(0, i1.GetHashCode());
        Assert.NotEqual(i1.GetHashCode(), i2.GetHashCode());
    }
コード例 #2
0
        public NetworkAddressKey(ImmutableArray <byte> IPv6Address, UInt16 Port)
        {
            this.IPv6Address = IPv6Address;
            this.Port        = Port;

            this._hashCode = Port.GetHashCode() ^ new BigInteger(IPv6Address.ToArray()).GetHashCode();
        }
コード例 #3
0
 /// <summary>
 /// Return the HashCode of this object.
 /// </summary>
 /// <returns>The HashCode of this object.</returns>
 public override Int32 GetHashCode()
 {
     unchecked
     {
         return(_Hour.GetHashCode() * 23 ^ _Minute.GetHashCode());
     }
 }
コード例 #4
0
 /// <summary>
 /// Return the HashCode of this object.
 /// </summary>
 /// <returns>The HashCode of this object.</returns>
 public override Int32 GetHashCode()
 {
     unchecked
     {
         return(_ISOCode.GetHashCode() * 17 ^ _Numeric.GetHashCode() * 23 ^ _Name.GetHashCode());
     }
 }
コード例 #5
0
    public override int GetHashCode()
    {
        var hashCode = 1213751429;

        hashCode = hashCode * -1521134295 + id.GetHashCode();
        hashCode = hashCode * -1521134295 + data.GetHashCode();
        return(hashCode);
    }
コード例 #6
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (UUID != null ? StringComparer.OrdinalIgnoreCase.GetHashCode(UUID) : 0);
         hashCode = (hashCode * 397) ^ Major.GetHashCode();
         hashCode = (hashCode * 397) ^ Minor.GetHashCode();
         return(hashCode);
     }
 }
コード例 #7
0
        public override int GetHashCode()
        {
            unchecked {
                int hash = 17;

                hash = hash * 29 + Preference.GetHashCode();
                hash = hash * 29 + Mailserver.GetHashCode();
                return(hash);
            }
        }
コード例 #8
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = Mss.GetHashCode();
         hashCode = (hashCode * 397) ^ Wscale.GetHashCode();
         hashCode = (hashCode * 397) ^ Sack.GetHashCode();
         hashCode = (hashCode * 397) ^ Timestamp.GetHashCode();
         return(hashCode);
     }
 }
コード例 #9
0
ファイル: UInt16Test.cs プロジェクト: raj581/Marvin
 public void TestGetHashCode()
 {
     try {
         MyUInt16_1.GetHashCode();
         MyUInt16_2.GetHashCode();
         MyUInt16_3.GetHashCode();
     }
     catch {
         Assert.Fail("GetHashCode should not raise an exception here");
     }
 }
コード例 #10
0
            public override int GetHashCode()
            {
                unchecked
                {
                    int hash = 17;

                    hash = hash * 23 + Mask.GetHashCode();
                    hash = hash * 23 + Offset.GetHashCode();

                    return(hash);
                }
            }
コード例 #11
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Port.GetHashCode();
         hashCode = (hashCode * 397) ^ (Ip != null ? Ip.GetHashCode() : 0);
         if (_markProvided)
         {
             hashCode = (hashCode * 397) ^ _mark;
             hashCode = (hashCode * 397) ^ _mask;
         }
         return(hashCode);
     }
 }
コード例 #12
0
 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);
     }
 }
コード例 #13
0
 /// <summary>
 /// Serves as a hash function for a particular type.
 /// </summary>
 /// <returns>
 /// A hash code for the current <see cref="T:System.Object"/>.
 /// </returns>
 /// <filterpriority>2</filterpriority>
 public override int GetHashCode()
 {
     unchecked
     {
         int result = Loop.GetHashCode();
         result = (result * 397) ^ OutPoint.GetHashCode();
         result = (result * 397) ^ InPoint.GetHashCode();
         result = (result * 397) ^ Length.GetHashCode();
         result = (result * 397) ^ HandPose.GetHashCode();
         result = (result * 397) ^ JointCount.GetHashCode();
         result = (result * 397) ^ (joints != null ? joints.GetHashCode() : 0);
         result = (result * 397) ^ EaseInTime.GetHashCode();
         result = (result * 397) ^ EaseOutTime.GetHashCode();
         result = (result * 397) ^ Priority;
         result = (result * 397) ^ unknown1.GetHashCode();
         result = (result * 397) ^ unknown0.GetHashCode();
         result = (result * 397) ^ positionkeys;
         result = (result * 397) ^ rotationkeys;
         return(result);
     }
 }
 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);
     }
 }
コード例 #15
0
 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);
     }
 }
コード例 #16
0
ファイル: CoilAddress.cs プロジェクト: dmcclean/automation
 public override int GetHashCode()
 {
     return(_wireValue.GetHashCode());
 }
コード例 #17
0
ファイル: Modifier.cs プロジェクト: gyyfifafans/PBO
 public override int GetHashCode()
 {
     return(n.GetHashCode());
 }
コード例 #18
0
ファイル: OptionalUInt16.cs プロジェクト: Bars1704/Flatout
 public override int GetHashCode()
 {
     // ReSharper disable NonReadonlyMemberInGetHashCode
     return(CombineHashCodes(hasValue.GetHashCode(), value.GetHashCode()));
     // ReSharper restore NonReadonlyMemberInGetHashCode
 }
コード例 #19
0
 public override int GetHashCode()
 {
     return(-1584136870 + Value.GetHashCode());
 }
コード例 #20
0
 public override int GetHashCode() => value.GetHashCode();
コード例 #21
0
ファイル: RemotingAddress.cs プロジェクト: MangaD/DAD-Project
        // https://www.loganfranken.com/blog/692/overriding-equals-in-c-part-2/
        public override int GetHashCode()
        {
            unchecked
            {
                // Choose large primes to avoid hashing collisions
                const int HashingBase       = (int)2166136261;
                const int HashingMultiplier = 16777619;

                int hash = HashingBase;
                hash = (hash * HashingMultiplier) ^ (!Object.ReferenceEquals(null, address) ? address.GetHashCode() : 0);
                hash = (hash * HashingMultiplier) ^ (!Object.ReferenceEquals(null, port) ? port.GetHashCode() : 0);
                hash = (hash * HashingMultiplier) ^ (!Object.ReferenceEquals(null, channel) ? channel.GetHashCode() : 0);
                return(hash);
            }
        }