ServiceCollectionHostedServiceExtensions.AddHostedService(IServiceCollection) ServiceCollectionHostedServiceExtensions.AddHostedService(IServiceCollection) ServiceCollectionHostedServiceExtensions.AddHostedService(IServiceCollection) Method

Definition

Add an IHostedService registration for the given type.

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddHostedService<THostedService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services) where THostedService : class, Microsoft.Extensions.Hosting.IHostedService;
static member AddHostedService : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'HostedService : null and 'HostedService :> Microsoft.Extensions.Hosting.IHostedService)
<Extension()>
Public Function AddHostedService(Of THostedService As {Class, IHostedService}) (services As IServiceCollection) As IServiceCollection

Type Parameters

THostedService

An IHostedService to register.

Parameters

Returns

Applies to