📜  c# 获取调用方法名称 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:41.849000             🧑  作者: Mango

代码示例2
//using System.Runtime.CompilerServices;
public void SendError(string Message, [CallerMemberName] string callerName = "") 
{ 
    Console.WriteLine(callerName + "called me."); 
} 
// You can also get the [CallerFilePath] and [CallerLineNumber].