clojure.lang.Reflector.GetInterfaceMethods C# (CSharp) Метод

GetInterfaceMethods() приватный статический Метод

private static GetInterfaceMethods ( Type targetType, string methodName, IList typeArgs, int arity ) : List
targetType System.Type
methodName string
typeArgs IList
arity int
Результат List
        private static List<MethodBase> GetInterfaceMethods(Type targetType, string methodName, IList<Type> typeArgs, int arity)
        {
            BindingFlags flags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod;

            List<Type> interfaces = new List<Type>();
            interfaces.Add(targetType);
            interfaces.AddRange(targetType.GetInterfaces());

            List<MethodBase> infos = new List<MethodBase>();

            foreach (Type type in interfaces)
            {
                IEnumerable<MethodInfo> einfo
                     = type.GetMethods(flags).Where(info => info.Name == methodName && info.GetParameters().Length == arity);
                foreach (MethodInfo minfo in einfo)
                    if (typeArgs == null && !minfo.ContainsGenericParameters)
                        infos.Add(minfo);
                    else if (typeArgs != null && minfo.ContainsGenericParameters)
                        infos.Add(minfo.MakeGenericMethod(typeArgs.ToArray<Type>()));
            }

            return infos;
        }