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

GetArityZeroMethod() публичный статический Метод

public static GetArityZeroMethod ( Type t, string name, bool getStatics ) : MethodInfo
t System.Type
name string
getStatics bool
Результат System.Reflection.MethodInfo
        public static MethodInfo GetArityZeroMethod(Type t, string name, bool getStatics)
        {
            BindingFlags flags = BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.InvokeMethod;
            if (getStatics)
                flags |= BindingFlags.Static;
            else
                flags |= BindingFlags.Instance;

            //MethodInfo[] all = t.GetMethods();

            IEnumerable<MethodInfo> einfo = t.GetMethods(flags).Where(mi => mi.Name == name && mi.GetParameters().Length == 0);
            List<MethodInfo> infos = new List<MethodInfo>(einfo);
            if (infos.Count() == 1)
                return infos[0];
            else
                return null;
        }