Pages Menu
TwitterRssFacebook
Categories Menu

Posted by on 6th April, 2007

Speed Test: Switch vs If-Else-If

Speed Test: Switch vs If-Else-If

Most of the times when I have to make the choice it really depends on the case…maybe I have only to check one or two cases, in which case, I choose if/else. However, I knew there was some sort of performance issue with one over the other, but never really knew the details. Well, the folks at BlackWasp have doen some extensive research and determined the pro’s and con’s, in terms of speed, of each of these two approaches. The .NET framework and the C# language provide two methods for conditional processing where multiple discrete values can be selected from. The switch statement is less flexible than the if-else-if ladder but is generally considered to be more efficient. [button link=”http://www.blackwasp.co.uk/SpeedTestIfElseSwitch.aspx” color=”#FFFFCC” size=”1″ style=”4″ dark=”1″]read...

Read More