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.

Required fields*

7
  • 1
    @Akxaya I still think switch should be extended in C#, but this looks fantastic and seems to work really well. Really appreciate you sharing this example. Thank you Commented Oct 4, 2016 at 10:27
  • This is not clear answer to range in switch/case question. Commented Oct 6, 2016 at 10:31
  • 13
    Dictionary doesn't store and return values in the order that they are added in. This happens to work with the Microsoft compiler, but one could easily write a complient compiler where it didn't work. Instead use List<KeyValuePair<Func<int, bool>, Action>>. Also be aware that there is a cost to generating the data structure and so it should probably be a static readonly member. Commented Nov 8, 2016 at 13:39
  • 1
    @PointerNull : please ref the blog for needed code written in comments for future reference Commented Nov 10, 2017 at 19:04
  • @NathanPhillips : thanks for bring this up. surly, IList collection would also be an alternative. this was just a sample I've implemented with complex parameters using List<t>. Commented Nov 10, 2017 at 19:09