在Java中的嵌套异常中,嵌套的Exception总是转到父类,因此它会发生两次,而初始异常下面的代码将永远不会被执行。如何在C#中防止它?
try
{
try
{
}
catch(Exception ex)
{
// Excep goes to parent Exception try catch
}
The code here is never executes
}
catch(Exception ex)
{
}
这可以解决您的问题:尝试{try {
}
catch(Exception ex)
{
// Excep goes to parent Exception try catch
}
finally
{
The code here is never executes
}
}
catch(Exception ex)
{
}