Share via


컴파일러 오류 CS0701

업데이트: 2007년 11월

오류 메시지

'identifier'은(는) 올바른 제약 조건이 아닙니다. 제약 조건으로 사용되는 형식은 인터페이스, 봉인되지 않은 클래스 또는 형식 매개 변수여야 합니다.
'identifier' is not a valid constraint. A type used as a constraint must be an interface, a non-sealed class or a type parameter.

이 오류는 sealed 형식을 제약 조건으로 사용하는 경우에 발생합니다. 이 오류를 해결하려면 sealed 형식이 아닌 형식만을 제약 조건으로 사용합니다.

예제

다음 샘플에서는 CS0701 오류가 발생하는 경우를 보여 줍니다.

// CS0701.cs
// compile with: /target:library
class C<T> where T : System.String {}   // CS0701
class D<T> where T : System.Attribute {}   // OK