您好,欢迎来到五一七教育网。
搜索
您的当前位置:首页用Callstack

用Callstack

来源:五一七教育网
   1: // First create an instance of the call stack
   2: StackTrace callStack = new StackTrace();
   3:  
   4: // Next select the frame we want...
   5: // 0 : current frame for the current method
   6: // 1 : Frame that called the current method
   7: // 2 : Frame that called the frame that called the current method
   8: // 3 : ...you get the idea!
   9: StackFrame frame = callStack.GetFrame(1);
  10:  
  11: // Using StackFrame.GetMethod(), which returns a 
  12: // MethodBase object, we can obtain detailed 
  13: // information about about a method
  14: MethodBase method = frame.GetMethod();
  15:  
  16: // Get the declaring type and method names 
  17: string declaringType = method.DeclaringType.Name;
  18: string methodName = method.Name;

转载于:https://www.cnblogs.com/fanweixiao/archive/2009/02/03/1382783.html

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- 517ttc.cn 版权所有 赣ICP备2024042791号-8

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务