示例#1
0
        public static void Main()
        {
            // Notice TargetSite and StackTrace
            var exceptionThrower = new ExceptionThrower();

            try
            {
                exceptionThrower.WithoutStacktrace();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            try
            {
                exceptionThrower.WithStacktrace();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            try
            {
                exceptionThrower.WithNewException();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
        public static void Main()
        {
            // Notice TargetSite and StackTrace
            var exceptionThrower = new ExceptionThrower();
            try
            {
                exceptionThrower.WithoutStacktrace();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }

            try
            {
                exceptionThrower.WithStacktrace();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }