컴파일러 경고 CS3024
업데이트: 2007년 11월
오류 메시지
'type' 제약 조건 형식이 CLS 규격이 아닙니다.
Constraint type 'type' is not CLS-compliant.
컴파일러에서는 CLS 규격이 아닌 형식을 제네릭 형식 제약 조건으로 사용하면 일부 언어로 작성된 코드에서 제네릭 클래스를 사용할 수 없게 될 수 있기 때문에 이 경고가 발생합니다.
이 경고를 나타나지 않게 하려면
- 형식 제약 조건에 CLS 규격 형식을 사용합니다.
예제
다음 예제의 여러 위치에서는 CS3024 오류가 발생하는 경우를 보여 줍니다.
// cs3024.cs
// Compile with: /target:library
[assembly: System.CLSCompliant(true)]
[type: System.CLSCompliant(false)]
public class TestClass // CS3024
{
public ushort us;
}
[type: System.CLSCompliant(false)]
public interface ITest // CS3024
{}
public interface I<T> where T : TestClass
{}
public class TestClass_2<T> where T : ITest
{}
public class TestClass_3<T> : I<T> where T : TestClass
{}
public class TestClass_4<T> : TestClass_2<T> where T : ITest
{}
public class Test
{
public static int Main()
{
return 0;
}
}