I have an UGLY logic tree that I'm looking at ways replace with some code generated from a table. It branches based on several thing:
- the length of a
List<AbstractType>
- the actual types in the list
- a flags
enum
My basic idea is to build some kind of decision tree from by input table. For the list length and flags that's easy (a switch
), but what about the types bit?
This question suggests that polymorphism is a good idea but that would mix concerns and strew code to the four winds in my case (and doesn't lend its self to generation anyway). The other suggested solution (IDictionary<Type, DelegateType>
) might work but seem a little ugly.
Does anyone have any suggestions.