Skip to content

ServiceCollectionExtensions.TryAddFromExisting(IServiceCollection)

TryAddFromExisting(IServiceCollection)

staticextension
View source
public static void TryAddFromExisting<TService, TImplementation>(this IServiceCollection services)
Registers an existing registration of TImplementation as a provider of TService if there are no existing TService implementations.

Parameters

servicesIServiceCollection
The service collection.