I have a function which takes a function pointer
like
public void myfunc<a,b>(Func<a,b> functionpointer)
{
String functionname;
// Do some magic to get functionpointers name and set it to functionname
}
Is it possible to get the function's name without running it?
I know that you can get the function name of the currently running function, but how do you get the name of a function that you're going to call?
Forgive me if such a question might have been posted before, i can't find a solution for it in C#
You can use MemberInfo.Name Property
string functionname = functionpointer.Method.Name;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With