Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Cannot convert null to 'type' because it is a non-nullable value type
The compiler cannot assign null to a value type; null can only be assigned to a reference type or to a Nullable type. struct is a value type. For more information, see Nullable Types (C# Programming Guide).
The following sample generates CS0037:
// CS0037.cs
public struct s
{
}
class a
{
public static void Main()
{
int i = null; // CS0037
s ss = null; // CS0037
}
}