获知哪个函数调用了本函数及它的类名

 

获知哪个函数调用了本函数及它的类名

StackTrace st = new StackTrace();
StackFrame callerFrame = st.GetFrame(2);
string callerInfo = callerFrame.GetMethod().DeclaringType.Name + "." + callerFrame.GetMethod().Name + "()";

posted @ 2013-11-24 16:16  swordzj  阅读(158)  评论(0编辑  收藏  举报