public Delegate GetGenericDelegate(MethodInfo info, Type instanceType, Type delegateType, bool useTyple, Type[] paramTypes) { Delegate result; var key = new LocalGenericDelegateCacheKey(info, instanceType, delegateType, useTyple, paramTypes); if (!GetCachedDelegate(key, globalGenericDelegateCache, localGenericDelegateCache, out result)) { result = CreateDelegate(info.MakeGenericMethod(paramTypes), instanceType, delegateType, useTyple); SetCachedDelegate(key, result, globalGenericDelegateCache, localGenericDelegateCache); } return(result); }
bool Equals(LocalGenericDelegateCacheKey other) { return(delegateType == other.delegateType && Equals(info, other.info) && instanceType == other.instanceType && Equals(paramTypes, other.paramTypes) && useTyple == other.useTyple); }