Method
TryAddKeyedInstance
func TryAddKeyedInstance(service: TypeInfo, key: object?, instance: object) -> Result<bool, ServiceError>
Declaring type: ServiceCollectionExtensions
Module: Neo.DependencyInjection
Assembly: Neo.DependencyInjection.Abstractions.dll
Extension from ServiceCollectionExtensions.TryAddKeyedInstance
Adds a caller-owned instance only when its service type/key is absent.
Parameters
| Name | Type | Description |
|---|---|---|
self |
ServiceCollection | |
service |
TypeInfo | |
key |
Object? | |
instance |
Object |