Skip to content

)} ,System.String)}

DependencyResolverRegistrar.RegisterConstant(Func) method

Defined in

Type: DependencyResolverRegistrar Namespace: ReactiveUI Assembly: ReactiveUI.Core.dll

Applies to

net10.0, net9.0, net8.0, net462, net481

Overloads

  1. public void RegisterConstant<TService>(Func<TService> factory) where TService : class

  2. public void RegisterConstant<TService>(Func<TService> factory, string? contract) where TService : class

1. Overload

public void RegisterConstant<TService>(Func<TService> factory) where TService : class

View source

Inherited documentation

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

Summary: Registers a constant value for a service type. The factory function is called once and the result is registered as a singleton.

Type parameters

NameDescription
TServiceThe service type to register.

Parameters

NameTypeDescription
factoryFuncA factory function that creates the service instance.

2. Overload

public void RegisterConstant<TService>(Func<TService> factory, string? contract) where TService : class

View source

Inherited documentation

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

Summary: Registers a constant value for a service type. The factory function is called once and the result is registered as a singleton.

Type parameters

NameDescription
TServiceThe service type to register.

Parameters

NameTypeDescription
factoryFuncA factory function that creates the service instance.
contractstring?An optional contract name for multiple registrations of the same type.