I wrote a class and I want to return the names of function which I implemented inside the class.
public class cls
{
public static string fun()
{
//code
}
}
Simply I want to know how to know the name of the function (which is fun), not the return value of that function.
public static void TraceContext(string messageFormat)
{
Trace.WriteLine(string.Format(messageFormat,
new System.Diagnostics.StackFrame(1).GetMethod().Name));
}
See How To: Obtain Method Name Programmatically For Tracing
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