ServiceCollectionDescriptorExtensions.TryAdd Метод
Определение
Перегрузки
TryAdd(IServiceCollection, ServiceDescriptor) |
Добавляет указанный |
TryAdd(IServiceCollection, IEnumerable<ServiceDescriptor>) |
Добавляет указанный |
TryAdd(IServiceCollection, ServiceDescriptor)
Добавляет указанный descriptor
в collection
, если этот тип службы еще не зарегистрирован.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)
Параметры
- collection
- IServiceCollection
- descriptor
- ServiceDescriptor
Добавляемый объект ServiceDescriptor.The ServiceDescriptor to add.
Применяется к
TryAdd(IServiceCollection, IEnumerable<ServiceDescriptor>)
Добавляет указанный descriptors
в collection
, если этот тип службы еще не зарегистрирован.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))
Параметры
- collection
- IServiceCollection
- descriptors
- IEnumerable<ServiceDescriptor>
Добавляемые ServiceDescriptor.The ServiceDescriptors to add.