Is there a possible way to write the next switch in some shorter, readable code?
switch (SomeValue)
{
case \"001\": return DoMethod1(); break;
case \"002
I use a Mapping extension for that. This way yoy can use the following syntax:
return SomeValue
.Map("001", DoMethod1)
.Map("002", DoMethod2)
//etc
This makes it also possible to do this:
return SomeValue
.Map(1, DoMethod1)
.Map(2, DoMethod2)
.Map(x => x < 0, DoMethod3)
.Map(x => x > 5 && x < 10, DoMethod4)
.Else(4); // a simple value of a method