ContainerRegister Method (Type, IEnumerableType)

Simple Injector
Registers all supplied implementationTypes based on the closed-generic version of the given openGenericServiceType with the transient lifestyle.

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

public void Register(
	Type openGenericServiceType,
	IEnumerable<Type> implementationTypes
)

Parameters

openGenericServiceType
Type: SystemType
The definition of the open generic type.
implementationTypes
Type: System.Collections.GenericIEnumerableType
A list types to be registered.
Exceptions

ExceptionCondition
ArgumentNullExceptionThrown when one of the arguments contain a null reference (Nothing in VB).
ArgumentExceptionThrown when openGenericServiceType is not an open generic type or when one of the supplied types from the implementationTypes collection does not derive from openGenericServiceType.
InvalidOperationExceptionThrown when the given set of implementationTypes contain multiple types that implement the same closed generic version of the given openGenericServiceType.
See Also

Reference