Compiler Error CS0453
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'
This error occurs when you use a non-value type argument in instantiating a generic type or method which has the value constraint on it. It can also occur when you use a nullable value type argument. See the last two lines of code in the following example.
Example
The following code generates this error.
// CS0453.cs
using System;
// Use of keyword struct restricts the type argument for S
// to any value type except Nullable.
public class HV<S> where S : struct { }
// The following examples cause error CS0453 because the type
// arguments do not meet the type restriction.
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
// The following examples do not cause error CS0453.
public class H6 : HV<int> { }
public class H7 : HV<char> { }
public class H8 : HV<bool> { }
public class H9<T> : HV<T> where T : struct { }
public struct MyStruct { }
public class H10 : HV<MyStruct> { }