2011/7/28

c# 執行中顯示行號,方便debug

需要兩個命名空間:
System.Diagnostics
System.Reflection

目前方法 string currentName = new StackTrace(true).GetFrame(0).GetMethod().Name;
呼叫名稱 string callName = new StackTrace(true).GetFrame(1).GetMethod().Name;
顯示行號 MessageBox.Show("Please Scan The First Unit ; Line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber().ToString(), "PrintTest Status");
               

沒有留言:

張貼留言