c#單利

oldfish__發表於2020-12-18
 static readonly System.Object lockThis = new object();
        private static Biz _Instance;
        public static Biz Instance
        {
            get
            {
                if (_Instance == null)
                    lock (lockThis)
                    {
                        if (_Instance == null)
                            _Instance = new Biz ();
                    }
                return _Instance;
            }
        }

相關文章