For non-async
methods one can use
System.Reflection.MethodBase.GetCurrentMethod().Name;
https://docs.microsoft.com/en-us/dotnet/api/system.reflection.methodbase.getcurrentmethod
Please remember that for async
methods it will return “MoveNext”.
More Related Contents:
- Open Source Alternatives to Reflector? [closed]
- How to loop through all the properties of a class?
- How to prevent ReflectionTypeLoadException when calling Assembly.GetTypes()
- Is it possible to set private property via reflection?
- How to get a Static property with Reflection
- Call and Callvirt
- INotifyPropertyChanged property name – hardcode vs reflection?
- Using .Net, how can I determine if a type is a Numeric ValueType?
- How to raise PropertyChanged event without using string name
- Can you get a Func (or similar) from a MethodInfo object?
- Finding the hosting PropertyInfo from the MethodInfo of getter/setter
- How to read assembly attributes
- Getting parent class’ name using Reflection
- In 3 minutes, What is Reflection?
- How to use Reflection to Invoke an Overloaded Method in .NET
- PhantomJS web driver stays in memory
- Is HttpClient safe to use concurrently?
- In what order are locations searched to load referenced DLLs?
- How to retrieve duration of MP3 in .NET?
- The repository itself is not usually tested?
- Sequential GUID in Linq-to-Sql?
- Sanitize table/column name in Dynamic SQL in .NET? (Prevent SQL injection attacks)
- Which Dependency Injection Tool Should I Use? [closed]
- Secure Password Hashing [closed]
- Detecting the number of processors
- Why is some sql query much slower when used with SqlCommand?
- How can I configure Entity Framework to automatically trim values retrieved for specific columns mapped to char(N) fields?
- Is it safe to call an RCW from a finalizer?
- Can we get the UAC prompt to show only once?
- Is the CallerMemberName attribute in 4.5 “able to be faked”?