/// <summary> /// Add the specified component registration. /// </summary> /// <param name="registration">Registration.</param> public void Add(IServiceRegistration registration) { if (registration == null) { throw new ArgumentNullException(nameof(registration)); } registration.AssertIsValid(); var key = ServiceRegistrationKey.ForRegistration(registration); lock (syncRoot) { IServiceRegistration removed; registrations.TryRemove(key, out removed); registrations.TryAdd(key, registration); } }