lundi 11 septembre 2023

C# - Global factory class to create and return instances

Is it a good design to have a global factory class in my C# application which is able to create every relevant class instance? So when the application is running and someone asks for class A it will be created on first call and just returned on all following calls. Then I have easy access to everything, everywhere the factory is accessible. On the other hand you often have access to instances you dont need which may be bad.

Aucun commentaire:

Enregistrer un commentaire