C#C
C#2y ago
3 replies
stigzler

Inheritance best practice: test Type of subclass or use enum?

See attched UML. Just wondering what the best practice is? Is it better to test the Type of BaseEffect in code:
if (effect is BlurEffect)

or to use an enum as per the UML:
if (effect.EffectType == EffectType.BlurEffect)
Screenshot_2024-04-03_103004.png
Was this page helpful?