Пример #1
0
        /// <summary>
        /// 单例模式的应用案例
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            var minlevel = ConfigV1.GetInstance()["MinLevel"];

            Console.WriteLine(minlevel);
            var maxLevel = ConfigV1.GetInstance()["MaxLevel"];

            Console.WriteLine(maxLevel);
            Console.ReadKey();
        }
Пример #2
0
 public static ConfigV1 GetInstance()
 {
     if (_instance == null)
     {
         lock (_lockObj)
         {
             if (_instance == null)
             {
                 _instance = new ConfigV1();
             }
         }
     }
     return(_instance);
 }