public static IToken Register([NotNull] this IMutableContainer container, [NotNull][ItemNotNull] IEnumerable <Type> types, [NotNull] IDependency dependency, [CanBeNull] ILifetime lifetime = null, [CanBeNull][ItemCanBeNull] object[] tags = null) { if (container == null) { throw new ArgumentNullException(nameof(container)); } if (types == null) { throw new ArgumentNullException(nameof(types)); } if (dependency == null) { throw new ArgumentNullException(nameof(dependency)); } var keys = from type in types from tag in tags ?? DefaultTags select new Key(type, tag); return(container.TryRegisterDependency(keys, dependency, lifetime, out var dependencyToken) ? dependencyToken : container.Resolve <ICannotRegister>().Resolve(container, keys, dependency, lifetime)); }