Compartir a través de


ServiceCollectionDescriptorExtensions.TryAdd Método

Definición

Sobrecargas

TryAdd(IServiceCollection, ServiceDescriptor)

Agrega el objeto descriptor especificado a collection si el tipo de servicio todavía no se ha registrado.

TryAdd(IServiceCollection, IEnumerable<ServiceDescriptor>)

Agrega el objeto descriptors especificado a collection si el tipo de servicio todavía no se ha registrado.

TryAdd(IServiceCollection, ServiceDescriptor)

Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs

Agrega el objeto descriptor especificado a collection si el tipo de servicio todavía no se ha registrado.

public:
[System::Runtime::CompilerServices::Extension]
 static void TryAdd(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Microsoft::Extensions::DependencyInjection::ServiceDescriptor ^ descriptor);
public static void TryAdd (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Microsoft.Extensions.DependencyInjection.ServiceDescriptor descriptor);
static member TryAdd : Microsoft.Extensions.DependencyInjection.IServiceCollection * Microsoft.Extensions.DependencyInjection.ServiceDescriptor -> unit
<Extension()>
Public Sub TryAdd (collection As IServiceCollection, descriptor As ServiceDescriptor)

Parámetros

descriptor
ServiceDescriptor

ServiceDescriptor que se va a agregar.

Se aplica a

TryAdd(IServiceCollection, IEnumerable<ServiceDescriptor>)

Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs

Agrega el objeto descriptors especificado a collection si el tipo de servicio todavía no se ha registrado.

public:
[System::Runtime::CompilerServices::Extension]
 static void TryAdd(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, System::Collections::Generic::IEnumerable<Microsoft::Extensions::DependencyInjection::ServiceDescriptor ^> ^ descriptors);
public static void TryAdd (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, System.Collections.Generic.IEnumerable<Microsoft.Extensions.DependencyInjection.ServiceDescriptor> descriptors);
static member TryAdd : Microsoft.Extensions.DependencyInjection.IServiceCollection * seq<Microsoft.Extensions.DependencyInjection.ServiceDescriptor> -> unit
<Extension()>
Public Sub TryAdd (collection As IServiceCollection, descriptors As IEnumerable(Of ServiceDescriptor))

Parámetros

descriptors
IEnumerable<ServiceDescriptor>

Las instancias de ServiceDescriptor que se van a agregar.

Se aplica a