12345678910111213141516171819202122232425262728293031323334353637 |
- namespace WWPipeLine.Commons
- {
-
-
-
-
- public class SingletonProvider<T> where T : class, new()
- {
- private static T _instance = null;
- private static object _instanceLock = new object();
- private SingletonProvider()
- {
- }
-
-
-
- public static T Instance
- {
- get
- {
- if (_instance == null)
- {
- lock (_instanceLock)
- {
- if (_instance == null)
- {
- _instance = new T();
- }
- }
- }
- return _instance;
- }
- }
- }
- }
|