ContainerRegister Method (Type, FuncObject)

Simple Injector
Registers the specified delegate that allows returning instances of serviceType.

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

public void Register(
	Type serviceType,
	Func<Object> instanceCreator
)

Parameters

serviceType
Type: SystemType
The base type or interface to register.
instanceCreator
Type: SystemFuncObject
The delegate that will be used for creating new instances.
Exceptions

ExceptionCondition
ArgumentNullExceptionThrown when either serviceType or instanceCreator are null references (Nothing in VB).
ArgumentExceptionThrown when serviceType represents an open generic type.
InvalidOperationException Thrown when this container instance is locked and can not be altered, or when an the serviceType has already been registered.
Remarks

This method uses the container's LifestyleSelectionBehavior to select the exact lifestyle for the specified type. By default this will be Transient.
See Also

Reference