C# 创建单例

    private static WorkFlow instance = null;
        private static readonly object syncObj = new object();
        /// <summary>  
        /// 创建实力
        /// </summary>
        public static WorkFlow Instance
        {
            get
            {
                if (instance == null)
                {
                    lock (syncObj)
                    {
                        if (instance == null)
                        {
                            instance = new WorkFlow();
                        }
                    }
                }
                return instance;
            }
        }
原文地址:https://www.cnblogs.com/dullbaby/p/4334251.html