Checking of presence of a value in nullable types in C#
Forums:
int? n1 = 42;
var exists1 = n1.HasValue;
//exists1 is True
int? n2 = null;
var exists2= n2 != null;
//exists2 is False
- Log in to post comments
int? n1 = 42;
var exists1 = n1.HasValue;
//exists1 is True
int? n2 = null;
var exists2= n2 != null;
//exists2 is False