コード例 #1
0
 public static MethodInfoEx GetMethodEx(this MethodInfo methodInfo, bool enableCaching = true)
 {
     if (enableCaching)
     {
         return(MethodInfoExCache.GetMethodEx(methodInfo));
     }
     else
     {
         return(new MethodInfoEx(methodInfo, false));
     }
 }
コード例 #2
0
 public static IEnumerable <MethodInfoEx> GetMethodsEx(this Type type, BindingFlags bindingFlags = PUBLIC_ISTANCE_STATIC, bool enableCaching = true)
 {
     if (enableCaching)
     {
         return(MethodInfoExCache.GetMethodsEx(type, bindingFlags));
     }
     else
     {
         return(type.GetMethods(bindingFlags)
                .Where(x => !x.ContainsGenericParameters)
                .Select(x => GetMethodEx(x, false)));
     }
 }
コード例 #3
0
 public static IReadOnlyDictionary <string, MethodInfoEx> GetMethodsExDic(this Type type, BindingFlags bindingFlags = PUBLIC_ISTANCE_STATIC, bool enableCaching = true)
 {
     if (enableCaching)
     {
         return(MethodInfoExCache.GetMethodsExDic(type, bindingFlags));
     }
     else
     {
         return(new ReadOnlyDictionary <string, MethodInfoEx>(
                    type.GetMethods(bindingFlags)
                    .Where(x => !x.ContainsGenericParameters)
                    .ToDictionary(x => x.Name, x => new MethodInfoEx(x, false))));
     }
 }
コード例 #4
0
 public static MethodInfoEx GetMethodEx(this Type type, string name, IEnumerable <Type> signature, BindingFlags bindingFlags = PUBLIC_ISTANCE_STATIC, bool enableCaching = true)
 {
     if (enableCaching)
     {
         return(MethodInfoExCache.GetMethodEx(type, name, signature, bindingFlags));
     }
     else
     {
         var f = (signature == null) ? type.GetMethod(name, bindingFlags) : type.GetMethod(name, bindingFlags, null, signature.ToArray(), null);
         if (f == null)
         {
             return(null);
         }
         return(new MethodInfoEx(f, false));
     }
 }