컴파일러 오류 CS0160
업데이트: 2007년 11월
오류 메시지
이전의 catch 절에서 이런 형식이나 상위 형식('type')의 예외를 모두 catch합니다.
A previous catch clause already catches all exceptions of this or of a super type ('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
}
}