最简单的单例

 /// <summary>

        /// 获取当前实例

        /// </summary>

        public static ClassTest Instance

        {

            get

            {

                if (_instance == null)

                {

                    lock (typeof(ClassTest ))

                    {

                        //创建实例

                        if (_instance == null){  _instance = new ClassTest ();}

                    }

                }

                return _instance;

            }

        }

原文地址:https://www.cnblogs.com/zhangji/p/2211180.html