12345678910111213141516171819202122 |
- namespace Blue
- {
- /// <summary>
- /// 单例模式的基类
- /// </summary>
- public class BlueSingleton<T> where T : BlueSingleton<T>, new()
- {
- private static T instance;
- public static T Instance
- {
- get
- {
- if (instance == null)
- {
- instance = new T();
- }
- return instance;
- }
- }
- }
- }
|