Skip to content

)} ,System.String)}

AppLocator.Register(Func) method

Defined in

Type: AppLocator Namespace: Splat Assembly: Splat.Core.dll

Applies to

net11.0, net10.0, net47, net471, net472, net48, net481

Overloads

  1. public static void Register<T>(Func<T?> factory)

  2. public static void Register<T>(Func<T?> factory, string contract)

1. Overload

public static void Register<T>(Func<T?> factory)

View source (opens in a new tab)

Summary: Register a function with the resolver which will generate an object for the specified service type.

Type parameters

NameDescription
TThe type which is used for the registration.

Parameters

NameTypeDescription
factoryFunc (opens in a new tab)The factory function which generates our object.

2. Overload

public static void Register<T>(Func<T?> factory, string contract)

View source (opens in a new tab)

Summary: Register a function with the resolver which will generate an object for the specified service type.

Type parameters

NameDescription
TThe type which is used for the registration.

Parameters

NameTypeDescription
factoryFunc (opens in a new tab)The factory function which generates our object.
contractstring (opens in a new tab)A contract value which will indicates to only generate the value if this contract is specified.