LR-20210131IOQH\Administrator
2021-09-13 24585d3e2e1e5a3b1873d8e0b46510d0bff0030b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace CY.Infrastructure.Singleton
{
    /// <summary>
    /// 单例模式
    /// </summary>
    public sealed class Singleton<T> where T : new()
    {
        private Singleton() { }
        public static T Instance
        {
            get { return SingletonCreator.instance; }
        }
        internal class SingletonCreator
        {
            static SingletonCreator() { }
            internal static readonly T instance = new T();
        }
    }
}