Skip to main content
added 118 characters in body
Source Link
Anonymous Duck
  • 3k
  • 1
  • 14
  • 35

This is a C# nullable types

Nullable types represent value-type variables that can be assigned the value of null. You cannot create a nullable type based on a reference type. (Reference types already support the null value.)

This line int b = a; throws an error because you cannot directly assign an int type into a nullable int type. In other words, int datatype cannot accept null value.

This is a C# nullable types

Nullable types represent value-type variables that can be assigned the value of null. You cannot create a nullable type based on a reference type. (Reference types already support the null value.)

This is a C# nullable types

Nullable types represent value-type variables that can be assigned the value of null. You cannot create a nullable type based on a reference type. (Reference types already support the null value.)

This line int b = a; throws an error because you cannot directly assign an int type into a nullable int type. In other words, int datatype cannot accept null value.

Source Link
Anonymous Duck
  • 3k
  • 1
  • 14
  • 35

This is a C# nullable types

Nullable types represent value-type variables that can be assigned the value of null. You cannot create a nullable type based on a reference type. (Reference types already support the null value.)