A single integer with a zero value can be used in various ways. It may be null or value. Like here:
int? myInt = null; myInt = SomeFunctionThatReturnsANumberOrNull() if (myInt != null) {
Say you want to know the age of a person. It is in the database if the person has submitted his age.
int? age = GetPersonAge("Some person");
If, like most women, a man has not submitted his age, then the database will contain zero.
Then you check the age value:
if (age == null) { // The person did not submit his/her age. } else { // This is probably a man... ;) }
Sani singh huttunen
source share