Last active
February 11, 2019 11:25
-
-
Save csharpforevermore/c508d0899af8d6440ddca4dc3e3d20c1 to your computer and use it in GitHub Desktop.
Get calling method name in any C# class.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string name = new System.Diagnostics.StackTrace().GetFrame(1).GetMethod().Name; | |
Console.WriteLine(name); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Modified version of code from Stackoverflow solution here