ServiceCollectionDescriptorExtensions.TryAdd Metodo

Definizione

Overload

TryAdd(IServiceCollection, ServiceDescriptor)

Aggiunge l'oggetto descriptor specificato a collection se il tipo di servizio non è già stato registrato.Adds the specified descriptor to the collection if the service type hasn't already been registered.

TryAdd(IServiceCollection, IEnumerable<ServiceDescriptor>)

Aggiunge l'oggetto descriptors specificato a collection se il tipo di servizio non è già stato registrato.Adds the specified descriptors to the collection if the service type hasn't already been registered.

TryAdd(IServiceCollection, ServiceDescriptor)

Aggiunge l'oggetto descriptor specificato a collection se il tipo di servizio non è già stato registrato.Adds the specified descriptor to the collection if the service type hasn't already been registered.

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)

Parametri

descriptor
ServiceDescriptor

Oggetto ServiceDescriptor da aggiungere.The ServiceDescriptor to add.

TryAdd(IServiceCollection, IEnumerable<ServiceDescriptor>)

Aggiunge l'oggetto descriptors specificato a collection se il tipo di servizio non è già stato registrato.Adds the specified descriptors to the collection if the service type hasn't already been registered.

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))

Parametri

descriptors
IEnumerable<ServiceDescriptor>

Oggetti ServiceDescriptor da aggiungere.The ServiceDescriptors to add.

Si applica a