Friday, January 7, 2011

call class method using a string name

using System.Reflection;

classdemo c1 = new classdemo();

// call function1

MethodInfo mi = typeof(classdemo).GetMethod("functionname_in_string_format");

// here function1 doesn't take any argument that's what we pass null

mi.Invoke(c1, null);

No comments:

Post a Comment