Multiple if blocks or a single if with AND condition
Posted
by Ram
on Stack Overflow
See other posts from Stack Overflow
or by Ram
Published on 2010-04-22T09:29:22Z
Indexed on
2010/04/22
12:43 UTC
Read the original article
Hit count: 181
coding-style
|c#
If I need to check multiple conditions, which is the preferred way with respect to performance
if( CND1 && CND2 && CND3 && CND4)
{
}
else
{
}
or
if(CND1)
{
if(CND2)
{
if(CND3)
{
if(CND4)
{
}
else
{
}
}
else
{
}
}
else
{
}
}
}
© Stack Overflow or respective owner