Click or drag to resize

GenericNonSingletonProvider class

Provides generic classes with private standard constructor as non-singletons.
Inheritance hierarchy
SystemObject
  NetEti.GlobalsGenericNonSingletonProvider

Namespace: NetEti.Globals
Assembly: NetEti.Global (in NetEti.Global.dll) Version: 1.0.0+ad672dc5430e1683eae7461ce3945c8e9dce1c49
Syntax
public static class GenericNonSingletonProvider

The GenericNonSingletonProvider Type exposes the following members.

Methods
 NameDescription of the
Public MethodStatic MemberGetInstanceT Returns an instance of the desired class.
Public MethodStatic MemberGetInstanceT(Boolean) Returns a new instance of the desired class.
Back to the top
Remarks
File: GenericNonSingletonProvider.cs
Source: josupeit.com/Weblog/Computer Science and Technology/C# and .NET in general/Implementation of the Singleton with minor adjustments from Erik Nagel, NetEti

08.03.2012 Erik Nagel: created
2012-03-08 Erik Nagel: Now not only existing instances are returned, if they have exactly the generic type T, but also if they are of T are derived. This means that within a framework, for example known base classes from unknown but derived classes as singletons can be accessed, even if the base classes derived from the classes must first be instantiated outside the framework.
See also