Пример #1
0
        public static T InstanceCustomCtor(Func <T> ctor)
        {
            if (ctor == null)
            {
                throw new ArgumentException("You must provide a valid constructor");
            }

            if (SingletonCreator._instance == null)
            {
                lock (_lock)
                {
                    if (SingletonCreator._instance == null)
                    {
                        SingletonCreator.Initialize(ctor);
                    }
                }
            }

            return(SingletonCreator._instance);
        }