ContainerRegisterCollectionTService Method (TService)

Simple Injector

Note: This API is now obsolete.

Registers a collection of singleton elements of type TService.

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

[ObsoleteAttribute("Please use Container.Collection.Register instead. Will be treated as an error from version 5.0. Will be removed in version 6.0.", 
	false)]
public void RegisterCollection<TService>(
	params TService[] singletons
)
where TService : class

Parameters

singletons
Type: TService
The collection to register.

Type Parameters

TService
The interface or base type that can be used to retrieve instances.
Exceptions

ExceptionCondition
InvalidOperationException Thrown when this container instance is locked and can not be altered, or when a singletons for TService has already been registered.
ArgumentNullExceptionThrown when singletons is a null reference.
ArgumentExceptionThrown when one of the elements of singletons is a null reference.
See Also

Reference