What is Nullable Type in .Net 2.0?
Nullable in .Net 2.0, helps to determine whether variable has been assigned a value or not. Example: Quiz application having option yes/no, but it should displayed “Not Attempted” when user does not make any choice.
Declaring a variable as nullable enables the HasValue and Value members.
// Shorthand notation for declaring nullable type, only for C#
bool? b = null;
Example of Nullable Type
Use HasValue to detect whether or not a value has been set:
Console.WriteLine("User has Attempted Given Question");
Console.WriteLine("User has not Attempted Given Question");
User has not Attempted Given Question
The Nullable type is a new feature in .NET 2.0.