【发布时间】:2011-04-06 18:01:28
【问题描述】:
在 C# 中你可以这样做:
try
{
// some code here
}
catch (MyCustomException)
{
// exception code here
}
catch (Exception)
{
// catches all other exceptions
}
注意catch (Type) 而不是catch (Type myVariable)。这在 VB.NET 中是否可行,还是在捕获异常类型时总是必须声明一个变量,如下所示:
Try
...
Catch var As NullReferenceException
...
Catch var As Exception
...
End Try
【问题讨论】:
标签: vb.net exception-handling c#-to-vb.net