I am new to C# and just learned that objects can be null in C# but int
can't.
Also how does nullable int (int?
) work in C#?
int
is a primitive type and only ReferenceType
s (objects) are nullable. You can make an int
nullable by wrapping it in an object:
System.Nullable<int> i;
-or-
int? i;