public static void TestGetHashCode() { Int32 i1 = 123; Int32 i2 = 654; Assert.NotEqual(0, i1.GetHashCode()); Assert.NotEqual(i1.GetHashCode(), i2.GetHashCode()); }
public override int GetHashCode() { return(objectType.GetHashCode() ^ name.GetHashCode() ^ objectRef.GetHashCode() ^ prop.GetHashCode()); }
/// <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()); }
/// <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); } }
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() ); }
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); }
public override int GetHashCode() { int hash = bindset.GetHashCode() * 17; hash = hash * 17 + bind.GetHashCode(); return(hash); }
public override int GetHashCode() { if (Equals(Id, default(int))) { return(base.GetHashCode()); } return(Id.GetHashCode()); }
public override int GetHashCode() { return (mVertexSize.GetHashCode() ^ mVertexCount.GetHashCode() ^ mByteOffset.GetHashCode() ^ mSwizzles.GetHashCode() ); }
public override Int32 GetHashCode() { unchecked { Int32 hash = 17; hash = hash * 23 + Value.GetHashCode(); return(hash); } }
public override int GetHashCode() { return (mName.GetHashCode() ^ mStartIndex.GetHashCode() ^ mMinVertexIndex.GetHashCode() ^ mVertexCount.GetHashCode() ^ mPrimitiveCount.GetHashCode() ); }
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); }
public override int GetHashCode() { if (_valueKey == null) { return(_valueId.GetHashCode()); } else { return(_valueKey.GetHashCode()); } }
public void TestGetHashCode() { try { MyInt32_1.GetHashCode(); MyInt32_2.GetHashCode(); MyInt32_3.GetHashCode(); } catch { Assert.Fail("GetHashCode should not raise an exception here"); } }
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(); }
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); }
// 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); }
public override Int32 GetHashCode() => value.GetHashCode();
public override int GetHashCode() { return(brushMeshID.GetHashCode()); }
/// <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()); }
public override int GetHashCode() { unchecked { return(_uid.GetHashCode() * 397); } }
public override int GetHashCode() { return(surfaceParameter.GetHashCode() ^ meshQuery.GetHashCode()); }
public override int GetHashCode() { return(m_first.GetHashCode()); }
public override Int32 GetHashCode() { return(id.GetHashCode()); }
public override int GetHashCode() => _depth.GetHashCode() ^ _fingerprint.GetHashCode() ^ _child.GetHashCode() ^ _chaincode.GetHashCode();
public override int GetHashCode() { return(base.GetHashCode() ^ data.GetHashCode()); }
/// <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();
public override Int32 GetHashCode() => Angle360.GetHashCode();
public override int GetHashCode() { return(Value.GetHashCode()); }
public override int GetHashCode() { return(Raw.GetHashCode()); }