Improvement to C# rule S1479: “switch” statements should not have too many “case” clauses…
-
The title suggests that the problem is “too many case clauses”, but the issue expressed by the rest of the documentation is that there are too many conceptual items in the list to be switched over. Perhaps the title should be “Too many “case” clauses in a “switch” statement indicates mapping against multiple sets of choices”.
-
The documentation provides a suggestion: “A real map structure would be more readable and maintainable, and should be used instead.” But there is no such thing as a C# ‘map structure.’ Instead, suggest using an enumeration. The process of creating the enumeration is likely to make the developers think about what values belong together and which don’t.