So I\'m creating a game in XNA, C# 4.0, and I need to manage a lot of PowerUps (which in code are all inherited from class \"PowerUp\"), and to handle back-end management of the
Sorry, I don't quite follow this, what are you actually trying to achieve; could you give a code excerpt? I'm not sure why you can't just use inheritance here and what an enumeration gives you that type inheritance doesn't. It feels to me like you're presenting the solution rather than the problem, I may be completely wrong, could you clarify how you're planning to use this meta-information?
I'm confused, are you asking for something that tells you the type of an instance of a type/class? You can use an enumeration to store a list of the types of each type that you say, but why do you want to? You say you don't want to have the other programmers use switch statements, but I'm sorry I can't see what benefit you're getting from storing the type information in some enumeration of... the type. Every instance knows what type it is and what it can do.
What will you do with the type information? If the types all inherit from a base type, then presumably they have common functionality that can be specified in an abstract
method for any special-case handling, or perhaps return a Null Object
where there's nothing to do (or maybe just do nothing). This way you don't need to worry about adding new classes- as they must have the necessary behaviour. I try to avoid Enum
s except in situations where you're actually enumerating a fixed set of arbitrary values, they are inflexible. Enum
s have to be maintained, which is very difficult (in practice).