Jignesh Kumar
What is difference between singleton design patten and class injected as singleton?
By Jignesh Kumar in .NET on Mar 07 2024
  • Alpesh Maniya
    Mar, 2024 11

    Singleton Design Pattern: - Involves defining a class with a private constructor and a static method or property to access the singleton instance. - The class itself controls object creation and access. - Suitable for situations where a single instance of a class is needed to coordinate actions across the system. - Provides a global point of access to the singleton instance.Class Injected as Singleton: - Relies on an external component, such as a dependency injection (DI) container, to manage singleton instances. - The singleton instance is created and managed by the DI container and injected into dependent classes as needed. - Promotes separation of concerns by decoupling object creation from object usage. - Enhances testability and maintainability by adhering to the principles of dependency inversion.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS