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

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

public static InvokeStaticMethod ( String typeName, String methodName, Object args ) : Object
typeName String
methodName String
args Object
Результат Object
        public static Object InvokeStaticMethod(String typeName, String methodName, Object[] args)
        {
            Type t = RT.classForName(typeName);
            return InvokeStaticMethod(t, methodName, args);
        }

Same methods

Reflector::InvokeStaticMethod ( Type t, String methodName, Object args ) : Object

Usage Example

Пример #1
0
            protected override object Read(PushbackTextReader r, char eq)
            {
                if (!RT.booleanCast(RT.READEVAL.deref()))
                {
                    throw new Exception("EvalReader not allowed when *read-eval* is false.");
                }
                Object o = read(r, true, null, true);

                if (o is Symbol)
                {
                    return(RT.classForName(o.ToString()));
                }
                else if (o is IPersistentList)
                {
                    Symbol fs = (Symbol)RT.first(o);
                    if (fs.Equals(THE_VAR))
                    {
                        Symbol vs = (Symbol)RT.second(o);
                        return(RT.var(vs.Namespace, vs.Name));  //Compiler.resolve((Symbol) RT.second(o),true);
                    }
                    if (fs.Name.EndsWith("."))
                    {
                        Object[] args = RT.toArray(RT.next(o));
                        return(Reflector.InvokeConstructor(RT.classForName(fs.Name.Substring(0, fs.Name.Length - 1)), args));
                    }
                    if (Compiler.NamesStaticMember(fs))
                    {
                        Object[] args = RT.toArray(RT.next(o));
                        return(Reflector.InvokeStaticMethod(fs.Namespace, fs.Name, args));
                    }
                    Object v = Compiler.maybeResolveIn(Compiler.CurrentNamespace, fs);
                    if (v is Var)
                    {
                        return(((IFn)v).applyTo(RT.next(o)));
                    }
                    throw new Exception("Can't resolve " + fs);
                }
                else
                {
                    throw new ArgumentException("Unsupported #= form");
                }
            }