public ConstructionKey(AssembledTypeID typeID, Type delegateType, bool allowNonPublic) { ArgumentUtility.DebugCheckNotNull("delegateType", delegateType); _typeID = typeID; _delegateType = delegateType; _allowNonPublic = allowNonPublic; // Pre-compute hash code. _hashCode = EqualityUtility.GetRotatedHashCode(_typeID.GetHashCode(), delegateType, allowNonPublic); }
public AssembledTypeID(Type requestedType, object[] parts) { ArgumentUtility.DebugCheckNotNull("requestedType", requestedType); ArgumentUtility.DebugCheckNotNull("parts", parts); _requestedType = requestedType; _parts = parts; // Pre-compute hash code. _hashCode = requestedType.GetHashCode() ^ EqualityUtility.GetRotatedHashCode(_parts); }
protected new int GetHashCode() { var fieldValues = new object[s_targetFields.Length]; for (int i = 0; i < fieldValues.Length; ++i) { fieldValues[i] = s_targetFields[i].GetValue(Target); } return(EqualityUtility.GetRotatedHashCode(fieldValues)); }
public CustomAttributeDataCacheKey(ICustomAttributeProvider attributeTarget, bool inherit) { ArgumentUtility.DebugCheckNotNull("attributeTarget", attributeTarget); Assertion.DebugAssert(!(attributeTarget is IMutableMember)); _attributeTarget = attributeTarget; _inherit = inherit; // Pre-compute hash code. _hashCode = EqualityUtility.GetRotatedHashCode(RuntimeHelpers.GetHashCode(attributeTarget), inherit); }
public ConstructorForAssembledTypeCacheKey(Type assembledType, Type delegateType, bool allowNonPublic) { ArgumentUtility.DebugCheckNotNull("assembledType", assembledType); ArgumentUtility.DebugCheckNotNull("delegateType", delegateType); _assembledType = assembledType; _delegateType = delegateType; _allowNonPublic = allowNonPublic; // Pre-compute hash code. _hashCode = EqualityUtility.GetRotatedHashCode(_assembledType.GetHashCode(), delegateType, allowNonPublic); }
public override int GetHashCode() { return(EqualityUtility.GetRotatedHashCode( _dataInfo, _selectProjection, _whereCondition, _topExpression, _isDistinctQuery, _rowNumberSelector, _currentRowNumberOffset, _groupByExpression) ^ EqualityUtility.GetRotatedHashCode(_sqlTables) ^ EqualityUtility.GetRotatedHashCode(_orderings)); }
public void GetRotatedHashCode_ForEnumerable() { IEnumerable objects1 = new int[] { 1, 2, 3 }; IEnumerable objects2 = new int[] { 1, 2, 3 }; Assert.That(EqualityUtility.GetRotatedHashCode(objects2), Is.EqualTo(EqualityUtility.GetRotatedHashCode(objects1))); IEnumerable objects3 = new int[] { 3, 2, 1 }; Assert.That(EqualityUtility.GetRotatedHashCode(objects3), Is.Not.EqualTo(EqualityUtility.GetRotatedHashCode(objects1))); IEnumerable objects4 = new int[] { 1, 2, 17 }; Assert.That(EqualityUtility.GetRotatedHashCode(objects4), Is.Not.EqualTo(EqualityUtility.GetRotatedHashCode(objects1))); }
public void GetRotatedHashCode_Nulls() { var array1 = new object[] { 1, null, 2 }; var array2 = new object[] { 1, null, 2 }; var array3 = new object[] { 1, null, null, 2 }; Assert.That(EqualityUtility.GetRotatedHashCode(array1), Is.EqualTo(EqualityUtility.GetRotatedHashCode(array2))); Assert.That(EqualityUtility.GetRotatedHashCode(array1), Is.Not.EqualTo(EqualityUtility.GetRotatedHashCode(array3))); Assert.That(EqualityUtility.GetRotatedHashCode((IEnumerable)array1), Is.EqualTo(EqualityUtility.GetRotatedHashCode((IEnumerable)array2))); Assert.That(EqualityUtility.GetRotatedHashCode((IEnumerable)array1), Is.Not.EqualTo(EqualityUtility.GetRotatedHashCode((IEnumerable)array3))); Assert.That(EqualityUtility.GetRotatedHashCode(array1), Is.EqualTo(EqualityUtility.GetRotatedHashCode((IEnumerable)array1))); Assert.That(EqualityUtility.GetRotatedHashCode(array3), Is.EqualTo(EqualityUtility.GetRotatedHashCode((IEnumerable)array3))); }
private SecurityContext( Type classType, string owner, string ownerGroup, string ownerTenant, bool isStateless, Dictionary <string, EnumWrapper> states, EnumWrapper[] abstractRoles) { _class = TypeUtility.GetPartialAssemblyQualifiedName(classType); _owner = StringUtility.EmptyToNull(owner); _ownerGroup = StringUtility.EmptyToNull(ownerGroup); _ownerTenant = StringUtility.EmptyToNull(ownerTenant); _isStateless = isStateless; _states = states; _abstractRoles = abstractRoles; _hashCode = EqualityUtility.GetRotatedHashCode(_class, _owner, _ownerGroup, _ownerTenant); }
/// <summary> /// Initializes a new instance of the <see cref="MixinContext"/> class. /// </summary> /// <param name="mixinKind">The kind of relationship the configured mixin has with its target class.</param> /// <param name="mixinType">The mixin type represented by this <see cref="MixinContext"/>.</param> /// <param name="introducedMemberVisibility">The default visbility of introduced members.</param> /// <param name="explicitDependencies">The explicit dependencies of the mixin.</param> /// <param name="origin"> /// A description of where the <see cref="MixinContext"/> originates from. Note that <paramref name="origin"/> is not considered when comparing /// <see cref="MixinContext"/> objects for equality. /// </param> public MixinContext( MixinKind mixinKind, Type mixinType, MemberVisibility introducedMemberVisibility, IEnumerable <Type> explicitDependencies, MixinContextOrigin origin) { ArgumentUtility.CheckNotNull("mixinType", mixinType); ArgumentUtility.CheckNotNull("explicitDependencies", explicitDependencies); ArgumentUtility.CheckNotNull("origin", origin); _mixinType = mixinType; _mixinKind = mixinKind; _introducedMemberVisibility = introducedMemberVisibility; _explicitDependencies = new HashSet <Type> (explicitDependencies).AsReadOnly(); _origin = origin; _cachedHashCode = EqualityUtility.GetRotatedHashCode( _mixinKind, _mixinType, EqualityUtility.GetXorHashCode(ExplicitDependencies), IntroducedMemberVisibility); }
/// <summary> /// Returns a hash code based on the members of the <see cref="IEnumerable{T}"/>. /// </summary> public override int GetHashCode() { return(EqualityUtility.GetRotatedHashCode(_enumerable)); }
public override int GetHashCode() { return(EqualityUtility.GetRotatedHashCode(_item1, _item2, _item3)); }
public override int GetHashCode() { return(PropertyType.GetHashCode() ^ EqualityUtility.GetRotatedHashCode(IndexParameterTypes)); }
public override int GetHashCode() { return(_genericTypeDefinition.GetHashCode() ^ EqualityUtility.GetRotatedHashCode(_typeArguments)); }
public override int GetHashCode() { return(EqualityUtility.GetRotatedHashCode(_group, _position)); }
public override int GetHashCode() { return(EqualityUtility.GetRotatedHashCode(SchemaName, EntityName)); }
public override int GetHashCode() { return(EqualityUtility.GetRotatedHashCode(_user, _role, _substitutedUser, _substitutedRole)); }
/// <summary> /// <see cref="GetHashCode"/> implementation using all the <see cref="object"/>|s in the array returned by the <see cref="Func{T,TResult}"/>. /// </summary> /// <remarks> /// Returned hash code uses the <see cref="EqualityUtility.GetRotatedHashCode(object[])"/> method. /// </remarks> public int GetHashCode(T x) { var equalityParticipantsX = _equalityParticipantsProvider(x); return(EqualityUtility.GetRotatedHashCode(equalityParticipantsX)); }
public override int GetHashCode() { return(EqualityUtility.GetRotatedHashCode(_elementType, _rank)); }
public override int GetHashCode() { return(EqualityUtility.GetRotatedHashCode(PropertyIdentifier, ClassDefinition)); }
public override int GetHashCode() { return(EqualityUtility.GetRotatedHashCode(s_globalKey, _localKey)); }
public override int GetHashCode() { return(EqualityUtility.GetRotatedHashCode(_name, _value, _parameterType)); }
public override int GetHashCode() { return(EqualityUtility.GetRotatedHashCode(_kind, _assembly, _location)); }
public int GetHashCode(MemberInfo obj) { ArgumentUtility.CheckNotNull("obj", obj); return(EqualityUtility.GetRotatedHashCode(obj.Name, _signatureComparer.GetHashCode(obj))); }