This question already has an answer here:
- Detect nullable type 6 answers
Probably a newb question but I am trying to find out if a variable is either a simple bool
or a Nullable<bool>
.
It seems that
if(val is Nullable<bool>)
returns true for both bool
and Nullable<bool>
variables and
if(val is bool)
also returns true for both bool
and Nullable<bool>
Basically, I am interesting in finding out if a simple bool
variable is true OR if a Nullable<bool>
variable is not null.
What's the way to do this?
Aucun commentaire:
Enregistrer un commentaire