As Drew says, simply by throwing an exception, the line does this. For example, this program:
using System; class Test { static void Main() { try { ThrowException(); } catch (Exception e) { Console.WriteLine(e); } } static void ThrowException() { try { ThrowException2(); } catch (Exception e) { throw new Exception("Outer", e); } } static void ThrowException2() { throw new Exception("Inner"); } }
Produces this conclusion:
System.Exception: Outer ---> System.Exception: Inner at Test.ThrowException2() at Test.ThrowException() --- End of inner exception stack trace --- at Test.ThrowException() at Test.Main()
Jon Skeet Dec 02 '08 at 13:52 2008-12-02 13:52
source share