Click here to Skip to main content
13,298,965 members (41,224 online)
Click here to Skip to main content
Add your own
alternative version


1 bookmarked
Posted 22 May 2010

.Net Performance tip - 3

Rate this:
Please Sign up or sign in to vote.
.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)


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!.



This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Vinayaka Krishna Shenoy
Architect MindTree Ltd
India India
Motivated achiever who guides organizations in applying technology to business settings, provides added value, and creates project deliverables in a timely manner. An experienced Technical Consultant, have successfully led large project teams of more than 20 people from requirements gathering to implementation and support using C#, .NET ,ADO.NET, ADO.NET Entity Framework,ASP.NET,ASP.NET MVC, WCF and SQL Server.

You may also be interested in...

Comments and Discussions

Questionmy vote 2+ Pin
joginder-banger26-Dec-14 7:48
professionaljoginder-banger26-Dec-14 7:48 
GeneralReason for my vote of 2 it depends on the outcome of the eva... Pin
johannesnestler25-May-10 6:06
memberjohannesnestler25-May-10 6:06 
GeneralReason for my vote of 1 useless without numbers Pin
SledgeHammer0122-May-10 9:08
memberSledgeHammer0122-May-10 9:08 
GeneralReason for my vote of 2 See my comments....... Pin
daveauld22-May-10 3:55
mentordaveauld22-May-10 3:55 
GeneralIt would be of benefit if you provided code on how you perfo... Pin
daveauld22-May-10 3:29
mentordaveauld22-May-10 3:29 
GeneralThis is not always true! Pin
daveauld22-May-10 3:54
memberdaveauld22-May-10 3:54 
GeneralRe: This is not always true! Pin
Vinayaka Krishna Shenoy22-May-10 6:34
memberVinayaka Krishna Shenoy22-May-10 6:34 
GeneralRe: This is not always true! Pin
daveauld22-May-10 7:37
memberdaveauld22-May-10 7:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.171207.1 | Last Updated 22 May 2010
Article Copyright 2010 by Vinayaka Krishna Shenoy
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid