Skip to content

)} ,System.String)}

ServiceLocator.AddSingleton(TContract) method

Defined in

Type: ServiceLocator Namespace: ReactiveMarbles.Locator Assembly: ReactiveMarbles.Locator.dll

Applies to

net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.0

Overloads

  • 1. public void AddSingleton<TContract>(TContract instance)
  • 2. public void AddSingleton<TContract>(TContract instance, string contract)
  • 3. public void AddSingleton<TContract>(Func<TContract> instanceFactory)
  • 4. public void AddSingleton<TContract>(Func<TContract> instanceFactory, string contract)

1. Overload

public void AddSingleton<TContract>(TContract instance)

View source

Inherited documentation

These docs were inherited from IEditServices. The member doesn't override them on this type.

Summary: Adds a single instance service.

Type parameters

NameDescription
TContractThe contract type.

Parameters

NameTypeDescription
instanceTContractThe instance.

2. Overload

public void AddSingleton<TContract>(TContract instance, string contract)

View source

Inherited documentation

These docs were inherited from IEditServices. The member doesn't override them on this type.

Summary: Adds a single instance service.

Type parameters

NameDescription
TContractThe contract type.

Parameters

NameTypeDescription
instanceTContractThe instance.
contractstringThe contract.

3. Overload

public void AddSingleton<TContract>(Func<TContract> instanceFactory)

View source

Inherited documentation

These docs were inherited from IEditServices. The member doesn't override them on this type.

Summary: Adds a single instance service.

Type parameters

NameDescription
TContractThe contract type.

Parameters

NameTypeDescription
instanceFactoryFuncThe instance factory.

4. Overload

public void AddSingleton<TContract>(Func<TContract> instanceFactory, string contract)

View source

Inherited documentation

These docs were inherited from IEditServices. The member doesn't override them on this type.

Summary: Adds a single instance service.

Type parameters

NameDescription
TContractThe contract type.

Parameters

NameTypeDescription
instanceFactoryFuncThe instance factory.
contractstringThe contract.