Let's say I've got 6 methods: Method1()
, Method2()
, Method3()
, Method4()
, Method5()
and Method6()
. I also have another method, SuperMethod(int nr)
, that will call one of the other methods. If the input to SuperMethod
is 1, Method1()
will be called and so on.
Can this be done in an elegant way without having a switch statement or stacking if-else statements?
I should add that this is not important production code I'm writing, so performance is not an issue.