更新:2007 年 11 月
错误消息
上一个 catch 子句已经捕获了此类型或超类型(“type”)的所有异常
一系列 catch 语句需要按派生的递减顺序排列。例如,派生程度最高的对象必须首先出现。
有关更多信息,请参见异常处理语句和异常和异常处理(C# 编程指南)。
下面的示例生成 CS0160:
// CS0160.cs
public class MyClass2 : System.Exception {}
public class MyClass
{
public static void Main()
{
try {}
catch(System.Exception) {} // Second-most derived; should be second catch
catch(MyClass2) {} // CS0160 Most derived; should be first catch
}
}