Esempio n. 1
0
 /// <summary>
 /// Returns dynamic method if one exists.
 /// </summary>
 /// <param name="method">Method to look up.</param>
 /// <param name="createCallback">callback function that will be called to create the dynamic method</param>
 /// <returns>An <see cref="IDynamicMethod"/> for the given method.</returns>
 internal static IDynamicMethod GetDynamicMethod(MethodInfo method, CreateMethodCallback createCallback)
 {
     lock (methodCacheLock)
     {
         IDynamicMethod dynamicMethod;
         if (!methodCache.TryGetValue(method, out dynamicMethod))
         {
             dynamicMethod       = createCallback(method);
             methodCache[method] = dynamicMethod;
         }
         return(dynamicMethod);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Returns dynamic method if one exists.
 /// </summary>
 /// <param name="method">Method to look up.</param>
 /// <param name="createCallback">callback function that will be called to create the dynamic method</param>
 /// <returns>An <see cref="IDynamicMethod"/> for the given method.</returns>
 internal static IDynamicMethod GetDynamicMethod(MethodInfo method, CreateMethodCallback createCallback)
 {
     lock (methodCache.SyncRoot)
     {
         IDynamicMethod dynamicMethod = (IDynamicMethod)methodCache[method];
         if (dynamicMethod == null)
         {
             dynamicMethod       = createCallback(method);
             methodCache[method] = dynamicMethod;
         }
         return(dynamicMethod);
     }
 }
 /// <summary>
 /// Returns dynamic method if one exists.
 /// </summary>
 /// <param name="method">Method to look up.</param>
 /// <param name="createCallback">callback function that will be called to create the dynamic method</param>
 /// <returns>An <see cref="IDynamicMethod"/> for the given method.</returns>
 internal static IDynamicMethod GetDynamicMethod(MethodInfo method, CreateMethodCallback createCallback)
 {
     lock (methodCache.SyncRoot)
     {
         IDynamicMethod dynamicMethod = (IDynamicMethod)methodCache[method];
         if (dynamicMethod == null)
         {
             dynamicMethod = createCallback(method);
             methodCache[method] = dynamicMethod;
         }
         return dynamicMethod;
     }
 }
 /// <summary>
 ///     Returns dynamic method if one exists.
 /// </summary>
 /// <param name="method">Method to look up.</param>
 /// <param name="createCallback">callback function that will be called to create the dynamic method</param>
 /// <returns>An <see cref="IDynamicMethod" /> for the given method.</returns>
 internal static IDynamicMethod GetDynamicMethod(MethodInfo method, CreateMethodCallback createCallback)
 {
     lock (_methodCacheLock)
     {
         IDynamicMethod dynamicMethod;
         if (!_methodCache.TryGetValue(method, out dynamicMethod))
         {
             dynamicMethod = createCallback(method);
             _methodCache[method] = dynamicMethod;
         }
         return dynamicMethod;
     }
 }