Users Pricing

forum

Home Forums How to call reflection method – MindStick

How to call reflection method

Anonymous User 2574 09 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));


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md