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