Пример #1
0
 protected TType _SetInstance <TType>(PspEmulatorComponent Instance) where TType : PspEmulatorComponent
 {
     if (ObjectsByType.ContainsKey(typeof(TType)))
     {
         throw(new InvalidOperationException());
     }
     ObjectsByType[typeof(TType)] = Instance;
     return((TType)Instance);
 }
Пример #2
0
 public TType SetInstance <TType>(PspEmulatorComponent Instance) where TType : PspEmulatorComponent
 {
     lock (this)
     {
         ConsoleUtils.SaveRestoreConsoleState(() =>
         {
             Console.ForegroundColor = ConsoleColor.Green;
             Console.WriteLine("PspEmulatorContext.SetInstance<{0}>", typeof(TType));
             //Console.WriteLine(Environment.StackTrace);
         });
         return(_SetInstance <TType>(Instance));
     }
 }