Esempio n. 1
0
        public override bool Equals(object obj)
        {
            MethodCacheKey key = obj as MethodCacheKey;

            if (key != null &&
                key.TypeName == this.TypeName &&
                key.MethodName == this.MethodName &&
                ArrayEquals(key.ParamTypes, this.ParamTypes))
            {
                return(true);
            }

            return(false);
        }
Esempio n. 2
0
 private static DynamicMethodHandle GetCachedMethod(object obj, MethodInfo info, params object[] parameters)
 {
     var key = new MethodCacheKey(obj.GetType().FullName, info.Name, GetParameterTypes(parameters));
     DynamicMethodHandle mh = null;
     if (!_methodCache.TryGetValue(key, out mh))
     {
         lock (_methodCache)
         {
             if (!_methodCache.TryGetValue(key, out mh))
             {
                 mh = new DynamicMethodHandle(info, parameters);
                 _methodCache.Add(key, mh);
             }
         }
     }
     return mh;
 }
Esempio n. 3
0
        private static DynamicMethodHandle GetCachedMethod(object obj, MethodInfo info, params object[] parameters)
        {
            var key = new MethodCacheKey(obj.GetType().FullName, info.Name, GetParameterTypes(parameters));
            DynamicMethodHandle mh = null;

            if (!_methodCache.TryGetValue(key, out mh))
            {
                lock (_methodCache)
                {
                    if (!_methodCache.TryGetValue(key, out mh))
                    {
                        mh = new DynamicMethodHandle(info, parameters);
                        _methodCache.Add(key, mh);
                    }
                }
            }
            return(mh);
        }