zoukankan      html  css  js  c++  java
  • Represents a stack trace, which is an ordered collection of one or more stack frames.

     static void Main(string[] args)
            {
                A();
                Console.ReadLine();
            }
    
            static void A()
            {
                B();
            }
    
            static void B()
            {
                C();
            }
    
            static void C()
            {
                StackTrace s = new StackTrace(true);
                Console.WriteLine($"Total frames: {s.FrameCount}");
                Console.WriteLine($"Current Method:{s.GetFrame(0).GetMethod().Name}");
                Console.WriteLine($"Calling method:{s.GetFrame(1).GetMethod().Name}");
                Console.WriteLine($"Entry method: {s.GetFrame(s.FrameCount - 1).GetMethod().Name}");
                Console.WriteLine("Call stack: ");
                foreach (StackFrame f in s.GetFrames())
                {
                    Console.WriteLine($"File:{f.GetFileName()} Line:{f.GetFileLineNumber()} col:{f.GetFileColumnNumber()}, Offset:{f.GetILOffset()}  Method:{f.GetMethod().Name}");
                }
            }
  • 相关阅读:
    数据库中总结2
    PyMySQL的基本使用
    数据库总结
    并发编程之多线程
    并发编程之多进程知识
    并发编程之多进程
    操作系统基础知识
    模块二总结
    Python函数进阶
    文件操作
  • 原文地址:https://www.cnblogs.com/Fred1987/p/13025095.html
Copyright © 2011-2022 走看看