SmartDIContainer.cs
/// <summary>
/// Adds a key-value pair with a class type and an instance of that class.
/// </summary>
/// <param name="instance">The instance of the type.</param>
/// <param name="typeToSaveAs">The keyed type for storage.</param>
Adds a key-value pair with a class type and an instance of that class.
Adds a key - value pair with a class type and an instance of that class .
protected void CreateSingletonInstance
      (
         object instance,
         Type   typeToSaveAs
      )
      {
         if (!_globalSingletonsByType.ContainsKey(typeToSaveAs))
         {
            _globalSingletonsByType.Add(typeToSaveAs, instance);
         }
         else
         {
            _globalSingletonsByType[typeToSaveAs] = instance;
         }
      }
protected void CreateSingletonInstance ( object instance , Type typeToSaveAs ) { if ( ! _globalSingletonsByType . ContainsKey ( typeToSaveAs ) ) { _globalSingletonsByType . Add ( typeToSaveAs , instance ) ; } else { _globalSingletonsByType [ typeToSaveAs ] = instance ; } }
Adds a key-value pair with a class type and an instance of that class.
Adds a key - value pair with a class type and an instance of that class .
instance
object
The instance of the type.
The instance of the type .
typeToSaveAs
Type
The keyed type for storage.
The keyed type for storage .