Pages

Wednesday, February 29, 2012

Nested IF conditions vs Single line IF with AND operation

In C#, compiler will generate the same MSIL code for following code chunks.

Single line IF

if ( A && B ){
  // Do something;
}

Nested IF

if ( A ){
  if ( B ) {
  // Do something;
  }
}

No comments:

Post a Comment