We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How to get the (new Type()).InvokeMember(....) 's output value?

hi, I'd like to ask a question about Reference: 1. Known Type's Name (String). 2. Known a public Method in the Class. Assembly assem = Assembly.Load("Test"); Type type = assem.GetType("Test.TestClass"); Object obj = Activator.CreateInstance( type ); Object[] args = new Object[1]; args[0] = "Hello"; type.InvokeMember( "GetMessage", BindingFlags.InvokeMethod, Type.DefaultBinder, obj, args ); // Then how to get the Return value? namespace Test { public class Test { public String GetMessage( String message ) { return message; } } } Thanks very much!

Live Chat Icon For mobile
Up arrow icon