C# StackTrace

            StackTrace trace = new StackTrace();
            //获取是哪个类来调用的  
            Type type = trace.GetFrame(1).GetMethod().DeclaringType;
            //获取是类中的那个方法调用的  
            string method = trace.GetFrame(1).GetMethod().ToString();

 

posted @ 2018-02-02 09:29  yunyun0574  阅读(1416)  评论(0编辑  收藏  举报