Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
ServiceCollectionDescriptorExtensions.TryAdd Method
Definition
- Assembly:
- Microsoft.Extensions.DependencyInjection.Abstractions.dll
- Package:
- Microsoft.Extensions.DependencyInjection.Abstractions v11.0.0-preview.5.26302.115
Important
Some information relates to prerelease product that may be substantially modified before itβs released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| TryAdd(IServiceCollection, ServiceDescriptor) |
Adds the specified |
| TryAdd(IServiceCollection, IEnumerable<ServiceDescriptor>) |
Adds the specified |
TryAdd(IServiceCollection, ServiceDescriptor)
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)
Parameters
- collection
- IServiceCollection
The IServiceCollection.
- descriptor
- ServiceDescriptor
The ServiceDescriptor to add.
Applies to
TryAdd(IServiceCollection, IEnumerable<ServiceDescriptor>)
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))
Parameters
- collection
- IServiceCollection
The IServiceCollection.
- descriptors
- IEnumerable<ServiceDescriptor>
The ServiceDescriptors to add.
Applies to
Feedback
Was this page helpful?
