Skip to content
loading...

re: How to avoid the Factory pattern in C# VIEW POST

TOP OF THREAD FULL DISCUSSION
re: I don't know that this accomplishes the main issue, you still have to know the concrete class in advance. You don't have a concrete class but still...
 

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.

code of conduct - report abuse