【发布时间】:2010-10-21 22:34:57
【问题描述】:
使用 C#,有没有更好的方法来处理多种类型的异常,而不是一堆丑陋的 catch 块?
这种情况的最佳做法是什么?
例如:
try
{
// Many types of exceptions can be thrown
}
catch (CustomException ce)
{
...
}
catch (AnotherCustomException ace)
{
...
}
catch (Exception ex)
{
...
}
【问题讨论】:
标签: c# .net exception error-handling