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

        Assert.NotEqual(0, i1.GetHashCode());
        Assert.NotEqual(i1.GetHashCode(), i2.GetHashCode());
    }
コード例 #2
0
 public override int GetHashCode()
 {
     return(objectType.GetHashCode()
            ^ name.GetHashCode()
            ^ objectRef.GetHashCode()
            ^ prop.GetHashCode());
 }
コード例 #3
0
        /// <summary>
        /// 获取属性值的哈希码。
        /// </summary>
        /// <returns></returns>
        public override int GetHashCode()
        {
            switch (StorageType)
            {
            case StorageType.Boolean: return(Boolean == null ? 0 : Boolean.GetHashCode());

            case StorageType.Byte: return(Byte == null ? 0 : Byte.GetHashCode());

            case StorageType.Char: return(Char == null ? 0 : Char.GetHashCode());

            case StorageType.DateTime: return(DateTime == null ? 0 : DateTime.GetHashCode());

            case StorageType.Decimal: return(Decimal == null ? 0 : Decimal.GetHashCode());

            case StorageType.Double: return(Double == null ? 0 : Double.GetHashCode());

            case StorageType.Enum: return(Enum == null ? 0 : Enum.GetHashCode());

            case StorageType.Guid: return(Guid == null ? 0 : Guid.GetHashCode());

            case StorageType.Int16: return(Int16 == null ? 0 : Int16.GetHashCode());

            case StorageType.Int32: return(Int32 == null ? 0 : Int32.GetHashCode());

            case StorageType.Int64: return(Int64 == null ? 0 : Int64.GetHashCode());

            case StorageType.Single: return(Single == null ? 0 : Single.GetHashCode());

            case StorageType.String: return(String == null ? 0 : String.GetHashCode());

            case StorageType.TimeSpan: return(TimeSpan == null ? 0 : TimeSpan.GetHashCode());
            }
            return(base.GetHashCode());
        }
コード例 #4
0
 /// <summary>
 /// Returns the hash code for this instance.
 /// </summary>
 /// <returns>A 32-bit signed integer that is the hash code for this instance.</returns>
 public override Int32 GetHashCode()
 {
     unchecked
     {
         return((_numerator.GetHashCode() >> 2) ^ _denominator.GetHashCode() ^ 295200001);
     }
 }
コード例 #5
0
ファイル: MLOD.cs プロジェクト: Onebeld/Regul
 public override int GetHashCode()
 {
     return(mName.GetHashCode()
            ^ mMaterialIndex.GetHashCode()
            ^ mVertexFormatIndex.GetHashCode()
            ^ mVertexBufferIndex.GetHashCode()
            ^ mIndexBufferIndex.GetHashCode()
            ^ mPrimitiveType.GetHashCode()
            ^ mFlags.GetHashCode()
            ^ mStreamOffset.GetHashCode()
            ^ mStartVertex.GetHashCode()
            ^ mStartIndex.GetHashCode()
            ^ mMinVertexIndex.GetHashCode()
            ^ mVertexCount.GetHashCode()
            ^ mPrimitiveCount.GetHashCode()
            ^ mSkinControllerIndex.GetHashCode()
            ^ mScaleOffsetIndex.GetHashCode()
            ^ mJointReferences.GetHashCode()
            ^ mBounds.GetHashCode()
            ^ mGeometryStates.GetHashCode()
            ^ mParentName.GetHashCode()
            ^ mMirrorPlane.GetHashCode()
            ^ mOwner.GetHashCode()
            );
 }
コード例 #6
0
ファイル: ByteBuffer.cs プロジェクト: wangweinjcn/Pelco-Media
        public override int GetHashCode()
        {
            // Auto-generated by Visual Studio

            var hashCode = -871570897;

            hashCode = hashCode * -1521134295 + EqualityComparer <byte[]> .Default.GetHashCode(_buffer);

            hashCode = hashCode * -1521134295 + _isOpen.GetHashCode();
            hashCode = hashCode * -1521134295 + _readOnly.GetHashCode();
            hashCode = hashCode * -1521134295 + _length.GetHashCode();
            hashCode = hashCode * -1521134295 + _capacity.GetHashCode();
            hashCode = hashCode * -1521134295 + _position.GetHashCode();
            hashCode = hashCode * -1521134295 + _startIndex.GetHashCode();
            hashCode = hashCode * -1521134295 + _isExpandable.GetHashCode();
            hashCode = hashCode * -1521134295 + IsReadOnly.GetHashCode();
            hashCode = hashCode * -1521134295 + IsOpen.GetHashCode();
            hashCode = hashCode * -1521134295 + Length.GetHashCode();
            hashCode = hashCode * -1521134295 + Capacity.GetHashCode();
            hashCode = hashCode * -1521134295 + Position.GetHashCode();
            hashCode = hashCode * -1521134295 + RemainingBytes.GetHashCode();
            hashCode = hashCode * -1521134295 + StartIndex.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <byte[]> .Default.GetHashCode(Raw);

            return(hashCode);
        }
コード例 #7
0
        public override int GetHashCode()
        {
            int hash = bindset.GetHashCode() * 17;

            hash = hash * 17 + bind.GetHashCode();
            return(hash);
        }
コード例 #8
0
 public override int GetHashCode()
 {
     if (Equals(Id, default(int)))
     {
         return(base.GetHashCode());
     }
     return(Id.GetHashCode());
 }
コード例 #9
0
 public override int GetHashCode()
 {
     return
         (mVertexSize.GetHashCode()
          ^ mVertexCount.GetHashCode()
          ^ mByteOffset.GetHashCode()
          ^ mSwizzles.GetHashCode()
         );
 }
コード例 #10
0
ファイル: PageContext.cs プロジェクト: Venzz/VkPhotos
 public override Int32 GetHashCode()
 {
     unchecked
     {
         Int32 hash = 17;
         hash = hash * 23 + Value.GetHashCode();
         return(hash);
     }
 }
コード例 #11
0
ファイル: MLOD.cs プロジェクト: Onebeld/Regul
 public override int GetHashCode()
 {
     return
         (mName.GetHashCode()
          ^ mStartIndex.GetHashCode()
          ^ mMinVertexIndex.GetHashCode()
          ^ mVertexCount.GetHashCode()
          ^ mPrimitiveCount.GetHashCode()
         );
 }
コード例 #12
0
        public override int GetHashCode()
        {
            var hashCode = 1947966917;

            hashCode = hashCode * -1521134295 + DrinkType.GetHashCode();
            hashCode = hashCode * -1521134295 + _sugarCount.GetHashCode();
            hashCode = hashCode * -1521134295 + HasStick.GetHashCode();
            hashCode = hashCode * -1521134295 + Message.GetHashCode();
            return(hashCode);
        }
コード例 #13
0
ファイル: DataEnum.cs プロジェクト: mhsabur/Serenity
 public override int GetHashCode()
 {
     if (_valueKey == null)
     {
         return(_valueId.GetHashCode());
     }
     else
     {
         return(_valueKey.GetHashCode());
     }
 }
コード例 #14
0
ファイル: Int32Test.cs プロジェクト: samcf111/unityMono5.5.0
 public void TestGetHashCode()
 {
     try {
         MyInt32_1.GetHashCode();
         MyInt32_2.GetHashCode();
         MyInt32_3.GetHashCode();
     }
     catch {
         Assert.Fail("GetHashCode should not raise an exception here");
     }
 }
コード例 #15
0
        private Serial(Int32 year, Int32 month, Int32 day, Int32 sequence)
        {
            _year     = year;
            _month    = month;
            _day      = day;
            _sequence = sequence;

            _stableHashCode = -1221578130;
            _stableHashCode = (_stableHashCode * -1521134295) + _year.GetHashCode();
            _stableHashCode = (_stableHashCode * -1521134295) + _month.GetHashCode();
            _stableHashCode = (_stableHashCode * -1521134295) + _day.GetHashCode();
            _stableHashCode = (_stableHashCode * -1521134295) + _sequence.GetHashCode();
        }
コード例 #16
0
    public bool PosTest1()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest1: check that if the return value is equal to the int32 ");

        try
        {
            Int32 i1 = TestLibrary.Generator.GetInt32(-55);
            Int32 i2 = i1.GetHashCode();
            if (i1 != i2)
            {
                TestLibrary.TestFramework.LogError("001", "int32.gethashcode is not equal to the int32 itself : " + i1);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e);
            retVal = false;
        }

        return(retVal);
    }
コード例 #17
0
ファイル: LinqFunc.cs プロジェクト: max-gui/babymission
        // If Equals() returns true for a pair of objects
        // then GetHashCode() must return the same value for these objects.

        public int GetHashCode(T element)
        {
            //Check whether the object is null
            if (Object.ReferenceEquals(element, null))
            {
                return(0);
            }

            //Get hash code for the Name field if it is not null.
            //int hashProductName = product.ProductPurposeResult == null ? 0 : product.ProductPurposeResult.GetHashCode();

            //Get hash code for the Code field.
            //int hashProductCode = product.ProductStockId.GetHashCode();

            //Calculate the hash code for the product.
            //return hashProductName ^ hashProductCode;
            Type t = typeof(T);

            Int32 element_mainId = (Int32)t.InvokeMember(mainIdName, BindingFlags.GetProperty, null, element, null);

            Int32 hashMainIdCode = element_mainId.GetHashCode();

            return(hashMainIdCode);
        }
コード例 #18
0
 public override Int32 GetHashCode() => value.GetHashCode();
コード例 #19
0
 public override int GetHashCode()
 {
     return(brushMeshID.GetHashCode());
 }
コード例 #20
0
ファイル: TId.cs プロジェクト: tsimafei-markhel/opt
 /// <summary>
 /// Serves as a hash function for a particular type
 /// </summary>
 /// <returns>A hash code for the current <see cref="TId"/></returns>
 public override Int32 GetHashCode()
 {
     return(value.GetHashCode());
 }
コード例 #21
0
 public override int GetHashCode()
 {
     unchecked {
         return(_uid.GetHashCode() * 397);
     }
 }
コード例 #22
0
 public override int GetHashCode()
 {
     return(surfaceParameter.GetHashCode() ^ meshQuery.GetHashCode());
 }
コード例 #23
0
 public override int GetHashCode()
 {
     return(m_first.GetHashCode());
 }
コード例 #24
0
ファイル: Lab4.cs プロジェクト: tokarskiy/TPR_Labs
 public override Int32 GetHashCode()
 {
     return(id.GetHashCode());
 }
コード例 #25
0
 public override int GetHashCode() => _depth.GetHashCode() ^ _fingerprint.GetHashCode() ^ _child.GetHashCode() ^ _chaincode.GetHashCode();
コード例 #26
0
 public override int GetHashCode()
 {
     return(base.GetHashCode() ^ data.GetHashCode());
 }
コード例 #27
0
 /// <summary>
 /// Returns the hash code for this instance.
 /// </summary>
 /// <returns>A 32-bit signed integer hash code.</returns>
 public override Int32 GetHashCode() => Source.GetHashCode() ^ Start.GetHashCode();
コード例 #28
0
 public override Int32 GetHashCode() => Angle360.GetHashCode();
コード例 #29
0
ファイル: BlockHandle.cs プロジェクト: tshhaha/Terab
 public override int GetHashCode()
 {
     return(Value.GetHashCode());
 }
コード例 #30
0
ファイル: Fixed.cs プロジェクト: RUSshy/ecs-types
 public override int GetHashCode()
 {
     return(Raw.GetHashCode());
 }