forum

Home / DeveloperSection / Forums / How to call reflection method

How to call reflection method

Anonymous User213909-Feb-2014

Is there an easier way to call reflection method instead of create methodInfo and object array as per below?

Assembly asm = Assembly.Load("Test");

Type t= asm.GetType("test.myclass");

object obj = Activator.CreateInstance(t);

MethodInfo mi = t.GetMethod("foo");

object[] args = { 10, 70 };

Console.WriteLine("output {0}", mi.Invoke(obj, args));


Updated on 09-Feb-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By