ServiceCollectionDescriptorExtensions.TryAdd Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Överlagringar
| Name | Description |
|---|---|
| TryAdd(IServiceCollection, ServiceDescriptor) |
Lägger till den angivna |
| TryAdd(IServiceCollection, IEnumerable<ServiceDescriptor>) |
Lägger till den angivna |
TryAdd(IServiceCollection, ServiceDescriptor)
Lägger till den angivna descriptor i collection om tjänsttypen inte redan har registrerats.
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)
Parametrar
- collection
- IServiceCollection
- descriptor
- ServiceDescriptor
Att ServiceDescriptor lägga till.
Gäller för
TryAdd(IServiceCollection, IEnumerable<ServiceDescriptor>)
Lägger till den angivna descriptors i collection om tjänsttypen inte redan har registrerats.
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))
Parametrar
- collection
- IServiceCollection
- descriptors
- IEnumerable<ServiceDescriptor>
De ServiceDescriptorsom ska läggas till.