What is the best alternative “On Error Resume Next” for C#?

后端 未结 11 2792
南方客
南方客 2021-02-19 08:12

If I put empty catch blocks for my C# code, is it going to be an equivalent for VB.NET\'s \"On Error Resume Next\" statement.

try
{
    C# code;
}

catch(excepti         


        
11条回答
  •  梦谈多话
    2021-02-19 08:43

    No, it's not the same.

    When using On Error Resume Next, VB would skip to the next line if an error occurs. With try/catch, execution jumps to the catch block if an error (exception) occurs.

提交回复
热议问题