65.9K
CodeProject is changing. Read more.
Home

.Net Performance tip - 3

starIconstarIconstarIcon
emptyStarIcon
starIcon
emptyStarIcon

3.60/5 (8 votes)

May 22, 2010

CPOL
viewsIcon

16850

.Net Performance tip - 3

.Net Performance tip - 3 Last week i was trying to explore how the if statement performs under various conditions as shown below.

if( statement 1)
{
 if( statement 2)
 {
  if( statement 3)
  {
   ......
  }
 }
}

vs

if( statement 1 && statement 2 && statement 3)
{
  .....
}

The results indicate that, the second approach is far better than the first one. Hence, the recommendation would be to use the second approach over the first one I hope this helps!. Regards, -Vinayak