singleton.cs

来自「是一个很好的编辑器」· CS 代码 · 共 29 行

CS
29
字号
using System;
using System.Collections.Generic;
using System.Text;

namespace GoogleRequester
{
    public class Singleton
    {
        private static Singleton instance = null;
        private static object lockObject = null;

        private Singleton()
        {
        }

        public static Singleton GetInstance()
        {
            lock (lockObject)
            {
                if (instance != null)
                    instance = new Singleton();

                return instance;
            }
        }

    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?