ServiceCollectionDescriptorExtensions.Add Method

Definition

Overloads

Add(IServiceCollection, ServiceDescriptor)

Adds the specified descriptor to the collection.

Add(IServiceCollection, IEnumerable<ServiceDescriptor>)

Adds a sequence of ServiceDescriptor to the collection.

Add(IServiceCollection, ServiceDescriptor)

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

Adds the specified descriptor to the collection.

C#
public static Microsoft.Extensions.DependencyInjection.IServiceCollection Add(this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Microsoft.Extensions.DependencyInjection.ServiceDescriptor descriptor);

Parameters

descriptor
ServiceDescriptor

The ServiceDescriptor to add.

Returns

A reference to the current instance of IServiceCollection.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)

Add(IServiceCollection, IEnumerable<ServiceDescriptor>)

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

Adds a sequence of ServiceDescriptor to the collection.

C#
public static Microsoft.Extensions.DependencyInjection.IServiceCollection Add(this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, System.Collections.Generic.IEnumerable<Microsoft.Extensions.DependencyInjection.ServiceDescriptor> descriptors);

Parameters

descriptors
IEnumerable<ServiceDescriptor>

The ServiceDescriptors to add.

Returns

A reference to the current instance of IServiceCollection.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)