public override int GetHashCode() { if (!_hashCode.HasValue) { int hashCode = 79 + 971 * (int)_thunkKind + 83 * (_targetFunctionPointer.GetHashCode() >> 7) + 13 * (_instantiatingArg.GetHashCode() >> 3); switch (_registrationKind) { case CallConversionInfoRegistrationKind.UsesMethodSignatureAndGenericArgs: hashCode ^= _methodSignature.GetHashCode(); hashCode = _typeArgs == null ? hashCode : TypeHashingAlgorithms.ComputeGenericInstanceHashCode(hashCode, _typeArgs); hashCode = _methodArgs == null ? hashCode : TypeHashingAlgorithms.ComputeGenericInstanceHashCode(hashCode, _methodArgs); break; case CallConversionInfoRegistrationKind.UsesArgIteratorData: hashCode ^= _argIteratorData.GetHashCode(); break; } _hashCode = hashCode; } return(_hashCode.Value); }
public RuntimeMethodHandleKey(RuntimeTypeHandle declaringType, string methodName, RuntimeSignature signature, RuntimeTypeHandle[] genericArgs) { // genericArgs will be null if this is a (typical or not) method definition // genericArgs are non-null only for instantiated generic methods. Debug.Assert(genericArgs == null || genericArgs.Length > 0); _declaringType = declaringType; _methodName = methodName; _signature = signature; _genericArgs = genericArgs; int methodNameHashCode = methodName == null ? 0 : methodName.GetHashCode(); _hashcode = methodNameHashCode ^ signature.GetHashCode(); if (genericArgs != null) { _hashcode ^= TypeHashingAlgorithms.ComputeGenericInstanceHashCode(declaringType.GetHashCode(), genericArgs); } else { _hashcode ^= declaringType.GetHashCode(); } }
public RuntimeMethodHandleKey(RuntimeTypeHandle declaringType, string methodName, RuntimeSignature signature, RuntimeTypeHandle[] genericArgs) { Debug.Assert(genericArgs != null); _declaringType = declaringType; _methodName = methodName; _signature = signature; _genericArgs = genericArgs; int methodNameHashCode = methodName == null ? 0 : methodName.GetHashCode(); _hashcode = TypeHashingAlgorithms.ComputeGenericInstanceHashCode(declaringType.GetHashCode(), genericArgs) ^ methodNameHashCode ^ signature.GetHashCode(); }