DEV Community

Discussion on: The Dream of C# 9.0

Collapse
 
ants profile image
ants

As pretty as the discriminated unions are, I was taught that if I am switching based on an object type, it is a code smell that I probably should be using polymorphism and the strategy pattern.

Collapse
 
integerman profile image
Matt Eland

And that largely holds true for object-oriented programming. DUs are more for supporting the functional flows of application logic.