This is kind of a silly question, but is it possible to get the name of the method that is currently being executed from within that method?
Public Sub SomeMethod() Dim methodName as String = System.Reflection.[function to get the current method name here?] End Sub
Thanks
Using MethodBase.GetCurrentMethod() method can be used, which returns a MethodBase object representing the currently executing method. That's all about getting the name of the current method in C#.
getMethodName() method returns the name of the method containing the execution point represented by this stack trace element. Thread. currentThread().
System.Reflection.MethodInfo.GetCurrentMethod();
The other methods are close to what was asked, but they don't return the string value. But this does:
Dim methodName$ = System.Reflection.MethodBase.GetCurrentMethod().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