if-else vs. switch vs. Dictionary of delegates (C#)

Fast Switching

While developing a Patch for the DCC support of SmartIrc4Net I rewrote the CTCP handling. Instead of a switch Statement I developed a Dictionary<string, ctcpDelegate> for the handling of the CTCP String. (i.e. I call the ctcp Handler after a Dictionary lookup of the CTCP String).

There are several Advantages to this:

Write a comment

Comments appear once they have been approved.