相关疑难解决方法(0)

C#异常处理失败

可能重复:
一次捕获多个异常?

在C#中有什么方法可以轻松实现以下pseduo代码:

try
{
...
}
catch ( ExceptionTypeA, ExceptionTypeB, ExceptionTypeC as ex)
{
... same code for all threw
}
Run Code Online (Sandbox Code Playgroud)

要么

try
{
...
}
catch ( ExceptionTypeA ex )
catch ( ExceptionTypeB ex )
catch ( ExceptionTypeC ex )
{
... same code for all exceptions of A, B or C
}
Run Code Online (Sandbox Code Playgroud)

我想我所说的将是很好的将在异常类型上落空.

c# exception-handling

14
推荐指数
3
解决办法
7953
查看次数

标签 统计

c# ×1

exception-handling ×1