Skip to content
Advertisement

Tag: function-calls

Calling a function from a string in C#

I know in php you are able to make a call like: Is this possible in .Net? Answer Yes. You can use reflection. Something like this: With the above code, the method which is invoked must have access modifier public. If calling a non-public method, one needs to use the BindingFlags parameter, e.g. BindingFlags.NonPublic | BindingFlags.Instance:

Advertisement