To get the name of the calling method in C# and VB.NET you can use the snippet below.
Sample C#
public static string GetCallingMethodName() { var stackTrace = new StackTrace(); return stackTrace.GetFrame(1).GetMethod().Name; }
Sample VB.NET
Public Shared Function GetCallingMethodName() As String Dim stackTrace = New StackTrace() Return stackTrace.GetFrame(1).GetMethod().Name End Function
RT @CodeSnippetsNET: How to get the name of the calling method in C# and #VB .NET http://t.co/tlHReYqf1Z #csharp #dotnet #visualbasic #prog…
RT @CodeSnippetsNET: How to get the name of the calling method in C# and #VB .NET http://t.co/tlHReYqf1Z #csharp #dotnet #visualbasic #prog…
RT @CodeSnippetsNET: How to get the name of the calling method in C# and #VB .NET http://t.co/tlHReYqf1Z #csharp #dotnet #visualbasic #prog…