标签归档:反射

web developer tips (83):通过反射从堆栈里获取调用的方法名称

原文地址:You can get the name of the calling method from th […]


原文地址:You can get the name of the calling method from the stack using reflection 几乎每个程序都需要一个日志来记录事件、错误和异常。有时候,在记录的事件里的方法名是很有用的,最简单的做法就是写一个“方法”,这个“方法”使用两个参数:调用的方法名和事件 http://www.watch-life.net/visual-studio/you-can-get-the-name-of-the-calling-method-from-the-stack-using-reflection.html [C#] 1: void Log(string callingMe...... [阅读全文]