Which is better for performance?
is it better to have:
Code:
if(condition1 && condition2)
{
}
or
Code:
if(condition1)
{
if(condition2)
{
}
}
Also is this still the case if doing so requires extra variable creation? Or in some cases even work preformed to the variable before check? (imagine if we also wanted to add something to value first or if we were trying to get an event string)
For example:
Code:
if(condition1)
{
new value=somemethod(var);
if(value<10)
{
}
}
OR
Code:
new value=somemethod(var);
if(condition1 && value<10)
{
}
So what do we do in order to ensure best performance? Thanks for the help
__________________