編譯器錯誤 CS0160
更新: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
}
}