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(); 
  } 
 } 
}