แก้ไข

แชร์ผ่าน


BindingContext.AddService Method

Definition

Overloads

AddService(Type, Func<IServiceProvider,Object>)

Adds the specified service factory to the binding context.

AddService<T>(Func<IServiceProvider,T>)

Adds the specified service factory to the binding context.

AddService(Type, Func<IServiceProvider,Object>)

Adds the specified service factory to the binding context.

public:
 void AddService(Type ^ serviceType, Func<IServiceProvider ^, System::Object ^> ^ factory);
public void AddService (Type serviceType, Func<IServiceProvider,object> factory);
member this.AddService : Type * Func<IServiceProvider, obj> -> unit
Public Sub AddService (serviceType As Type, factory As Func(Of IServiceProvider, Object))

Parameters

serviceType
Type

The type for which this service factory will provide an instance.

factory
Func<IServiceProvider,Object>

A delegate that provides an instance of the specified service type.

Applies to

AddService<T>(Func<IServiceProvider,T>)

Adds the specified service factory to the binding context.

public:
generic <typename T>
 void AddService(Func<IServiceProvider ^, T> ^ factory);
public void AddService<T> (Func<IServiceProvider,T> factory);
member this.AddService : Func<IServiceProvider, 'T> -> unit
Public Sub AddService(Of T) (factory As Func(Of IServiceProvider, T))

Type Parameters

T

The type for which this service factory will provide an instance.

Parameters

factory
Func<IServiceProvider,T>

A delegate that provides an instance of the specified service type.

Applies to