ContainerCollectionRegistratorAppendTService Method (FuncTService, Lifestyle)

Simple Injector
Appends the specified delegate instanceCreator to existing registrations made for a collection of TService elements using one of the Container.Collections.Register overloads.

Namespace:  SimpleInjector
Assembly:  SimpleInjector (in SimpleInjector.dll) Version: 4.6.0
Syntax

public void Append<TService>(
	Func<TService> instanceCreator,
	Lifestyle lifestyle
)
where TService : class

Parameters

instanceCreator
Type: SystemFuncTService
The delegate that allows building or creating new instances.
lifestyle
Type: SimpleInjectorLifestyle
The lifestyle that specifies how the returned instance will be cached.

Type Parameters

TService
The element type of the collections to register.
Exceptions

ExceptionCondition
ArgumentNullExceptionThrown when one of the supplied arguments is a null reference (Nothing in VB).
ArgumentExceptionThrown when the TService is not a reference type, or ambiguous.
InvalidOperationExceptionThrown when the container is locked.
NotSupportedExceptionThrown when the method is called for a registration that is made with one of the Collections.Register overloads that accepts a dynamic collection (an IEnumerable or IEnumerable<TService>).
See Also

Reference