ContainerRegisterCollection Method (Type, IEnumerable)

Simple Injector

Note: This API is now obsolete.

Registers a dynamic (container uncontrolled) collection of elements of type serviceType. A call to GetAllInstancesTService will return the containerUncontrolledCollection itself, and updates to the collection will be reflected in the result. If updates are allowed, make sure the collection can be iterated safely if you're running a multi-threaded application.

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

[ObsoleteAttribute("Please use Container.Collection.Register instead. Will be removed in version 6.0.", 
	true)]
public void RegisterCollection(
	Type serviceType,
	IEnumerable containerUncontrolledCollection
)

Parameters

serviceType
Type: SystemType
The base type or interface for elements in the collection.
containerUncontrolledCollection
Type: System.CollectionsIEnumerable
The collection of items to register.
Exceptions

ExceptionCondition
ArgumentNullExceptionThrown when one of the supplied arguments is a null reference.
ArgumentExceptionThrown when serviceType represents an open generic type.
See Also

Reference