在代码中获取行号和文件信息代码用c#编写

时间:2014-10-14 08:34:36

标签: c# .net

我想使用c#代码获取行号和文件信息及方法信息,其中提供代码的确切内容。

提前致谢。

例如,假设我在c#中有代码

private void method1()
{
  //code lines written here


  // how to get the line,method and class information here for code written in this method1 function  here for logging mechanism.
  //(expected output here :  Function method1 called, line number(actual in file or method) is executed.
}

我想知道.net提供任何API来获取该信息。我不想从方法输入中获取该信息,但是例如让我们说第33行有获取此信息的代码然后输出应该:第33行,执行< / p>

0 个答案:

没有答案