码迷,mamicode.com
首页 > 其他好文 > 详细

获取当前方法名称

时间:2017-07-04 13:21:26      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:span   获取   new   height   comment   nbsp   get   tac   etc   

//获取当前方法名称

System.Reflection.MethodBase.GetCurrentMethod().Name

//获取调用本方法的方法名称

new System.Diagnostics.StackTrace().GetFrame(1).GetMethod().Name

//GetFrame(1)中1代表上级,2代表上上级,以此类推  

获取当前方法名称

标签:span   获取   new   height   comment   nbsp   get   tac   etc   

原文地址:http://www.cnblogs.com/dongzhou/p/7115933.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!