Esempio n. 1
0
        public static T Get <T>() where T : ISingletonInstance, new()
        {
            if (_instance == null)
            {
                _instance = new T();
            }

            return((T)_instance);
        }
Esempio n. 2
0
 static bool TryGet(Type type, out ISingletonInstance dependency)
 {
     lock (syncRoot) {
         SingletonInstance instance;
         if (!dict.TryGetValue(type, out instance))
         {
             dependency = null;
             return(false);
         }
         dependency = (ISingletonInstance)instance.Instance;
         return(true);
     }
 }