jacew <an*******@discussions.microsoft.com> wrote:
Does anyone know if its possible to call a method from it's string reproesentation e.g.
int CallFN(string FunctionName)
{
return ... FunctionName...
}
So if a method exists called GetAge which returns the number 12
I want to call this by calling
CallFn("GetAge");
You need to use reflection. Have a look at Type.GetMethod to find out
how to get the method, and then the Invoke method on the returned
MethodInfo to run it. A reflection tutorial on the net will no doubt
give more information.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too