lundi 28 décembre 2015

Check .HasValue and .Value for bool

I've need to do some refactoring and I came across to this:

if(LoanTerms.RateIncreasable.HasValue && LoanTerms.RateIncreasable.Value) { ... }

and LoanTerms.RateIncreasable is type of bool?

So I'm wondering do I need .HasValue check on this? Will null be treated like false in if statement?

Aucun commentaire:

Enregistrer un commentaire