Timeline for Refactoring Switch Statements and is there any real use for Switch Statements at all?
Current License: CC BY-SA 3.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 10, 2015 at 15:43 | comment | added | Zan Lynx | @DavidArno: "the complete opposite"? The way I read it we said exactly the same thing. How can it be opposite? | |
| Oct 10, 2015 at 12:56 | comment | added | David Arno | @ZanLynx, the complete opposite is true, at least with C#. If you look at the IL produced for a non-trivial switch statement, you'll see the compiler turns it into a dictionary.as it is faster. | |
| May 4, 2012 at 20:07 | comment | added | Zan Lynx | And really, if you unrolled the factory and the dictionary and the lookup, it would turn out to be basically a switch statement: if array[hash(search)] then call array[hash(search)]. Although it would be runtime-extendable which compiled switches are not. | |
| May 4, 2012 at 18:54 | history | answered | Telastyn | CC BY-SA 3.0 |