CJ7*_*CJ7 0 vb.net error-handling
在VB.NET中应该使用什么错误处理?
应该使用" On Error Goto ErrorHandler ... Exit Sub ErrHandler ... End Sub"模式还是应该使用" try { ... } catch { ... } finally { ... }"模式?
"尝试{...}抓住{...}终于{...}"模式远射.
C#
try
{
// Do Something that may go wrong
}
catch (Exception ex)
{
//Do something with the error
}
finally
{
//Cleanup
}
Run Code Online (Sandbox Code Playgroud)
要么
VB
Try
// Do Something that may go wrong
Catch ex as Exception
//Do something with the error
Finally
//Cleanup
End Try
Run Code Online (Sandbox Code Playgroud)