using System.Runtime.CompilerServices;
public static void Main()
Console.WriteLine("Hello World");
public static void GetCaller([CallerMemberName] string callerMemberName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int sourceLineNumber = 0)
StringBuilder sb = new StringBuilder();
sb.AppendLine($"MethodBase.GetCurrentMethod() = {MethodBase.GetCurrentMethod()}");
sb.AppendLine($"MethodBase.GetCurrentMethod().Name = {MethodBase.GetCurrentMethod().Name}");
sb.AppendLine($"MethodBase.GetCurrentMethod().DeclaringType = {MethodBase.GetCurrentMethod().DeclaringType}");
sb.AppendLine($"MethodBase.GetCurrentMethod().DeclaringType.FullName = {MethodBase.GetCurrentMethod().DeclaringType.FullName}");
sb.AppendLine($"{nameof(callerMemberName)} = {callerMemberName}");
sb.AppendLine($"{nameof(callerFilePath)} = {callerFilePath}");
sb.AppendLine($"{nameof(sourceLineNumber)} = {sourceLineNumber}");
Console.WriteLine(sb.ToString());