单例

    public class Singleton
    {
        public static Singleton Instance=new Singleton();
        public int Id { get; set; }
    private Singleton()
    { }

    public int Name { get; set; }

}

单例 模式的关键点在于: 构造韩式 private 不能外部 new,   只能内部new

气功波(18037675651)
原文地址:https://www.cnblogs.com/qgbo/p/15616939.html