When I declare an int
as nullable
int? i=null;
Does i
here become a reference type?
No, a nullable is a struct. What is happening is that the nullable struct has two values:
int
for int?
, DateTime
for DateTime?
, etc.).HasValue
is the property.)When you set the value of the data type, the struct changes HasValue
to true.