Better use of Switch or if statement


Based on the combination of Car make, Car model and Car Manufacturing year i’m performing some actions, right now I’m using a switch like below, but it’s very static and timeconsuming to maintain, so I’m looking for a more dynamic/easy way of achieving the same.


Firstly it would be great to be able to decrease the numbers of statements as many of the cases performs the same activity - TESLA MODEL S 2013->2017 are the same, but from 2018-now does the same but yet different from 13->17.
Also if the performed activity is the same for all, for example all Model X cases performs the same activity, how can I “skip” the check on manufacaturing year on some of the cases but not all of them?

Any good ideas? is Switch the correct approach or should I perhaps use nested if’s?


How about using Dictionary as the following? It will decrease number of Case.

It might be good idea to use config file to make the dictionary.

Hope this helps you.