Share via


컴파일러 오류 CS0453

업데이트: 2007년 11월

오류 메시지

'Generic Identifier' 메서드 또는 제네릭 형식에서 'Parameter Name' 매개 변수로 사용하려면 'Type Name' 형식은 nullable이 아닌 값 형식이어야 합니다.
The type 'Type Name' must be a non-nullable value type in order to use it as parameter 'Parameter Name' in the generic type or method 'Generic Identifier'

이 오류는 value 제약 조건이 있는 제네릭 형식이나 메서드를 인스턴스화할 때 값이 아닌 형식 인수를 사용하는 경우에 발생합니다. null을 허용하는 값 형식 인수를 사용하는 경우에도 이 오류가 발생할 수 있습니다. 다음 예제의 마지막 두 줄을 참조하십시오.

예제

다음 코드는 이 오류 오류를 발생시킵니다.

// CS0453.cs
using System;
public class HV<S> where S : struct { }
public class H1 : HV<string> { }                   // CS0453
public class H2 : HV<H1> { }                       // CS0453
public class H3<S> : HV<S> where S : class { }     // CS0453
public class H4 : HV<int?> { }                     // CS0453
public class H5 : HV<Nullable<Nullable<int>>> { }  // CS0453