DEV Community

Discussion on: How to avoid the Factory pattern in C#

Collapse
thatblairguy profile image
That Blair Guy

The enum certainly forces a recompile, but you can use strings instead.

But the Creator methods (whether declared as delegates or Funcs) would encapsulate the knowledge of the concrete classes. All the factory needs to know is that it has a function to call and that function has a specific signature.