Skip to content

)} ,System.Threading.LazyThreadSafetyMode)} ,System.String)} ,System.String,System.Threading.LazyThreadSafetyMode)} )} ,System.String)}

ServiceLocator.AddLazySingleton(Lazy) 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 AddLazySingleton<TContract>(Lazy<TContract> lazy)
  • 2. public void AddLazySingleton<TContract>(Func<TContract> instanceFactory, LazyThreadSafetyMode threadSafetyMode)
  • 3. public void AddLazySingleton<TContract>(Lazy<TContract> lazy, string contract)
  • 4. public void AddLazySingleton<TContract>(Func<TContract> instanceFactory, string contract, LazyThreadSafetyMode threadSafetyMode)
  • 5. public void AddLazySingleton<TContract>(Func<TContract> instanceFactory)
  • 6. public void AddLazySingleton<TContract>(Func<TContract> instanceFactory, string contract)

1. Overload

public void AddLazySingleton<TContract>(Lazy<TContract> lazy)

View source

Inherited documentation

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

Summary: Adds a lazy single instance service.

Type parameters

NameDescription
TContractThe contract type.

Parameters

NameTypeDescription
lazyLazyThe lazy instance.

2. Overload

public void AddLazySingleton<TContract>(Func<TContract> instanceFactory, LazyThreadSafetyMode threadSafetyMode)

View source

Inherited documentation

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

Summary: Adds a lazy single instance service.

Type parameters

NameDescription
TContractThe contract type.

Parameters

NameTypeDescription
instanceFactoryFuncThe instance factory.
threadSafetyModeLazyThreadSafetyModeThe thread safety mode.

3. Overload

public void AddLazySingleton<TContract>(Lazy<TContract> lazy, string contract)

View source

Inherited documentation

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

Summary: Adds a lazy single instance service.

Type parameters

NameDescription
TContractThe contract type.

Parameters

NameTypeDescription
lazyLazyThe lazy instance.
contractstringThe contract.

4. Overload

public void AddLazySingleton<TContract>(Func<TContract> instanceFactory, string contract, LazyThreadSafetyMode threadSafetyMode)

View source

Inherited documentation

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

Summary: Adds a lazy single instance service.

Type parameters

NameDescription
TContractThe contract type.

Parameters

NameTypeDescription
instanceFactoryFuncThe instance factory.
contractstringThe contract.
threadSafetyModeLazyThreadSafetyModeThe thread safety mode.

5. Overload

public void AddLazySingleton<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 lazy single instance service.

Type parameters

NameDescription
TContractThe contract type.

Parameters

NameTypeDescription
instanceFactoryFuncThe instance factory.

6. Overload

public void AddLazySingleton<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 lazy single instance service.

Type parameters

NameDescription
TContractThe contract type.

Parameters

NameTypeDescription
instanceFactoryFuncThe instance factory.
contractstringThe contract.