If I have made a variable of a non-reference type, say int
, nullable, i.e. int?
, does this mean I need to use a constructor before assigning a value?
Normally to intialise a non-reference type variable I simply do
int foo = 5;
But if I have a nullable non-reference data type variable is initialisation neccessary, as below, or can I still use the simple initialisation above?
int? foo = new int();
foo = 5;