I'd like to get the fully qualified method name. I can see how to get the method name on its own with the following:
System.Reflection.MethodBase.GetCurrentMethod().Name
but this only returns the actual name. I need everything, like:
My.Assembly.ClassName.MethodName
Try
var methodInfo = System.Reflection.MethodBase.GetCurrentMethod();
var fullName = methodInfo.DeclaringType.FullName + "." + methodInfo.Name;
You probably want the GetCurrentMethod().DeclaringType, which returns a Type object that holds information about the class which declares the method. Then you can use FullName property to get the namespace.
var currentMethod = System.Reflection.MethodBase.GetCurrentMethod();
var fullMethodName = currentMethod.DeclaringType.FullName + "." + currentMethod.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