Articles → CSHARP → Nullable Datatypes

Nullable Datatypes





int? i;






  1. HasValue → Set to true if there is a value stored, else false
  2. Value → Get the value of variable


int? i = null;
int j;
j = i;




j = (int)i;




int? i;
int j = 5;
i = j;



Lifted Operators




int? a = 3;
int b = 4;
int? c = a * b; // valid
int c = a * b; //invalid



Removing Nullability




int? i = null;
int j = 4;
int? c = i??j;





Posted By  -  Karan Gupta
 
Posted On  -  Friday, September 10, 2010

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250