您好,
我看到人们重新抛出异常,如下所示。哪一个是最佳的?为什么一种机制最优于另一种机制。
try
{
// do something
}
catch (exception ex)
{
// do something
throw ex;
}
try
{
// do something
}
catch (exception ex)
{
// do something
throw;
}
答案 0 :(得分:0)
好吧,我不了解其他人,但有时我们会使用第二种方法来记录错误,然后将其捕获到其他地方。