using system; 
using system.diagnostics; 
namespace stacktracetest 
{ 
 /**//// <summary> 
 /// class1 的摘要说明。 
 /// </summary> 
 class class1 
 { 
  /**//// <summary> 
  /// 应用程序的主入口点。 
  /// </summary> 
  [stathread] 
  static void main(string[] args) 
  { 
   method2(); 
   //输出method2 
  } 
   
  static private void method1() 
  { 
   stacktrace st=new stacktrace(true); 
   console.writeline(st.getframe(1).getmethod().name.tostring());    
  } 
  static private void method2() 
  { 
         method1();  
   console.readline(); 
  } 
 } 
} 
新闻热点
疑难解答