Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • 2
    Very interesting solution... in some ways this is terrible :) ... but in some ways this is incredible (especially in the event that some other external developer could tap into this system by creating class "X" and then supplying the 'what to do with X' logic ... sorta like a mini DI/Ioc) Commented Sep 5, 2011 at 1:28
  • 9
    When "in some ways this is terrible"? Commented Jul 18, 2013 at 22:34
  • 1
    @cdiggins, is there a way I can add something like "default" or "none of them" ? Commented Jul 18, 2013 at 22:51
  • @cdiggins though this is a clever camouflage, but no better than using if , else if, as it would behave when it would sequentially traverse the Case statements Commented Feb 13, 2016 at 13:09
  • 1
    @Pedro77 Yes you can check the existence of the Key in the Switch method and if it doesn't exist, then use the typeof(Object) for the default case in the end of Case chain Commented Feb 13, 2016 at 13:11