Nested if statements or not
Posted
by Zaps
on Stack Overflow
See other posts from Stack Overflow
or by Zaps
Published on 2010-06-17T09:38:36Z
Indexed on
2010/06/17
9:43 UTC
Read the original article
Hit count: 243
c#
|if-statement
Hi,
I hope this hasn't been asked before.
I have a nullable boolean called boolIsAllowed and a if condition like so:
if(boolIsAllowed.HasValue && boolIsAllowed.Value)
{
//do something
}
My question is this good code or would I be better separating it into a nested if statement? Will the second condition get checked if boolIsAllowed.HasValue is equal to false and then throw an exception?
I hope this question is too stupid.
Thanks in advance.
© Stack Overflow or respective owner