SmartDIContainer.cs
/// <summary>
/// Removes a global instance as long as it is the same type and reference.
/// </summary>
/// <typeparam name="ObjectT">The type of the object t.</typeparam>
/// <param name="obj">The object.</param>
Removes a global instance as long as it is the same type and reference.
Removes a global instance as long as it is the same type and reference .
protected void RemoveSingletonInstance<ObjectT>(ObjectT obj)
      {
         var foundSingleton = _globalSingletonsByType.FirstOrDefault(s => ReferenceEquals(s.Value, obj));
         if (foundSingleton.IsNotAnEqualObjectTo(default(KeyValuePair<Type, object>)))
         {
            _globalSingletonsByType.Remove(foundSingleton.Key);
         }
      }
protected void RemoveSingletonInstance < ObjectT > ( ObjectT obj ) { var foundSingleton = _globalSingletonsByType . FirstOrDefault ( s => ReferenceEquals ( s . Value , obj ) ) ; if ( foundSingleton . IsNotAnEqualObjectTo ( default ( KeyValuePair < Type , object > ) ) ) { _globalSingletonsByType . Remove ( foundSingleton . Key ) ; } }
Removes a global instance as long as it is the same type and reference.
Removes a global instance as long as it is the same type and reference .
// Find the singleton based on the reference and *not* by the type, as any interface type might be declared, but // the constructor could easily hand us a base type.
obj
ObjectT
None
typeparam
The type of the object t.
The type of the object t .