I've had no real luck getting a concise answer for this comparison by using Google and rather than do my own time consuming evaluations, I thought I would ask first.
I'm fairly sure that a switch statement using Enums would perform faster than an if-then-else statement, though whether or not it is a noticable difference is another question.
Could someone shed some light on this for me?
Thanks for the quick responses guys, I will keep this in mind for future projects.
Yeap, it does, because in general term a switch statement works faster than if/else chain.
Although bytecode generated is not always definitive source for performance comparisons you can examine it to have a better idea.
For instance this code:
Generates the following:
Which seems to be pretty fast in both cases.
So, pick the one that is easier to maintain.