C# 获取调用者信息
时间:2020-06-07 20:35:31
收藏:0
阅读:59
StackTrace
类
public static void LogWrite(string logInfo,
[CallerFilePath] string file=null,
[CallerLineNumber] int line=0,
[CallerMemberName] string member=null
)
{
Console.WriteLine(logInfo);
Console.WriteLine(file);
Console.WriteLine(line);
Console.WriteLine(member);
}
https://www.codeproject.com/Tips/606379/Caller-Info-Attributes-in-Csharp-5-0
原文:https://www.cnblogs.com/baiqian/p/13061581.html
评论(0)