SimpleInjectorGenericHostExtensionsAddHostedServiceTHostedService Method

Simple Injector
Registers the given THostedService in the Container as Singleton and adds it to the host's pipeline of hosted services.

Namespace:  SimpleInjector
Assembly:  SimpleInjector.Integration.GenericHost (in SimpleInjector.Integration.GenericHost.dll) Version: 4.6.0
Syntax

public static SimpleInjectorAddOptions AddHostedService<THostedService>(
	this SimpleInjectorAddOptions options
)
where THostedService : class, IHostedService

Parameters

options
Type: SimpleInjector.Integration.ServiceCollectionSimpleInjectorAddOptions
The options.

Type Parameters

THostedService
An IHostedService to register.

Return Value

Type: SimpleInjectorAddOptions
The options.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type SimpleInjectorAddOptions. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference