The .HasValue property of values ββwith zero values ββcan be quite useful sometimes. Having a nullable bool is similar to having a bool in a bool. Take the Chuong Les database example , when you read a cell, you can check if the cell really matters before continuing (and ends with an error further down the line).
Instead of making sure this is not the case, before reading the cell you can use a variable with a null value and use if (aNullableBool.HasValue) to make sure you have a value before continuing.
As you said, if you are not at risk of getting a variable that gets null , you should use the default value.
source share