How can I get the line number which threw exception?

后端 未结 12 2173
既然无缘
既然无缘 2020-11-27 09:14

In a catch block, how can I get the line number which threw an exception?

12条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-27 10:00

    It works:

    var LineNumber = new StackTrace(ex, True).GetFrame(0).GetFileLineNumber();
    

提交回复
热议问题