ContainerRegisterSingletonTConcrete Method

Simple Injector
Registers a single concrete instance that will be constructed using constructor injection and will be returned when this instance is requested by type TConcrete. This TConcrete must be thread-safe when working in a multi-threaded environment. If TConcrete implements IDisposable, a created instance will get disposed when Container.Dispose gets called.

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

public void RegisterSingleton<TConcrete>()
where TConcrete : class

Type Parameters

The concrete type that will be registered.

InvalidOperationException Thrown when this container instance is locked and can not be altered, or when TConcrete has already been registered.
ArgumentExceptionThrown when the TConcrete is a type that can not be created by the container.
See Also