//行号
private static int GetLineNum()
{

    System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(1, true);

    return st.GetFrame(0).GetFileLineNumber();
}

//文件名

private static string GetFileName()

{

System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(1, true);

return st.GetFrame(0).GetFileName();

}

//函数

private static string GetFuncName()

{

System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(1, true);

return st.GetFrame(0).GetMethod()

}

相关文章:

  • 2022-02-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-21
  • 2022-12-23
  • 2022-02-19
猜你喜欢
  • 2022-02-09
  • 2022-12-23
  • 2022-12-23
  • 2021-08-06
  • 2022-12-23
  • 2021-12-05
相关资源
相似解决方案