ServiceCollectionDescriptorExtensions.RemoveAllKeyed Method

Definition

Overloads

RemoveAllKeyed(IServiceCollection, Type, Object)

Source:
ServiceCollectionDescriptorExtensions.Keyed.cs
Source:
ServiceCollectionDescriptorExtensions.Keyed.cs
Source:
ServiceCollectionDescriptorExtensions.Keyed.cs

Removes all services of type serviceType in IServiceCollection.

C#
public static Microsoft.Extensions.DependencyInjection.IServiceCollection RemoveAllKeyed(this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type serviceType, object? serviceKey);

Parameters

serviceType
Type

The service type to remove.

serviceKey
Object

The service key.

Returns

The IServiceCollection for chaining.

Applies to

.NET 9 (package-provided) y otras versiones
Producto Versiones
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)

RemoveAllKeyed<T>(IServiceCollection, Object)

Source:
ServiceCollectionDescriptorExtensions.Keyed.cs
Source:
ServiceCollectionDescriptorExtensions.Keyed.cs
Source:
ServiceCollectionDescriptorExtensions.Keyed.cs

Removes all services of type T in IServiceCollection.

C#
public static Microsoft.Extensions.DependencyInjection.IServiceCollection RemoveAllKeyed<T>(this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, object? serviceKey);

Type Parameters

T

Parameters

serviceKey
Object

The service key.

Returns

The IServiceCollection for chaining.

Applies to

.NET 9 (package-provided) y otras versiones
Producto Versiones
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)