Tag: rethrow

抛出VS重新抛出:同样的结果?

在网上引用了很多文档,特别是在SO上,例如: 在C#中重新抛出exception的正确方法是什么? “扔e”之间应该有区别 和“扔;”。 但是,来自: http : //bartdesmet.net/blogs/bart/archive/2006/03/12/3815.aspx , 这段代码: using System; class Ex { public static void Main() { // // First test rethrowing the caught exception variable. // Console.WriteLine(“First test”); try { ThrowWithVariable(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } // // Second test performing a blind rethrow. // Console.WriteLine(“Second test”); try { […]