Registers the specified delegate that allows returning instances of serviceType.
Namespace: SimpleInjector
Assembly: SimpleInjector (in SimpleInjector.dll) Version: 5.3.0
Syntax
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
Exception | Condition |
---|---|
ArgumentNullException | Thrown when either serviceType or instanceCreator are null references. |
ArgumentException | Thrown 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
See Also