แชร์ผ่าน


ActivatorUtilities.CreateFactory Method

Definition

Overloads

CreateFactory(Type, Type[])

Creates a delegate that will instantiate a type with constructor arguments provided directly and/or from an IServiceProvider.

CreateFactory<T>(Type[])

Create a delegate that will instantiate a type with constructor arguments provided directly and/or from an IServiceProvider.

CreateFactory(Type, Type[])

Source:
ActivatorUtilities.cs
Source:
ActivatorUtilities.cs
Source:
ActivatorUtilities.cs

Creates a delegate that will instantiate a type with constructor arguments provided directly and/or from an IServiceProvider.

public:
 static Microsoft::Extensions::DependencyInjection::ObjectFactory ^ CreateFactory(Type ^ instanceType, cli::array <Type ^> ^ argumentTypes);
public static Microsoft.Extensions.DependencyInjection.ObjectFactory CreateFactory (Type instanceType, Type[] argumentTypes);
static member CreateFactory : Type * Type[] -> Microsoft.Extensions.DependencyInjection.ObjectFactory
Public Shared Function CreateFactory (instanceType As Type, argumentTypes As Type()) As ObjectFactory

Parameters

instanceType
Type

The type to activate.

argumentTypes
Type[]

The types of objects, in order, that will be passed to the returned function as its second parameter.

Returns

A factory that will instantiate instanceType using an IServiceProvider and an argument array containing objects matching the types defined in argumentTypes.

Applies to

CreateFactory<T>(Type[])

Source:
ActivatorUtilities.cs
Source:
ActivatorUtilities.cs
Source:
ActivatorUtilities.cs

Create a delegate that will instantiate a type with constructor arguments provided directly and/or from an IServiceProvider.

public:
generic <typename T>
 static Microsoft::Extensions::DependencyInjection::ObjectFactory<T> ^ CreateFactory(cli::array <Type ^> ^ argumentTypes);
public static Microsoft.Extensions.DependencyInjection.ObjectFactory<T> CreateFactory<T> (Type[] argumentTypes);
static member CreateFactory : Type[] -> Microsoft.Extensions.DependencyInjection.ObjectFactory<'T>
Public Shared Function CreateFactory(Of T) (argumentTypes As Type()) As ObjectFactory(Of T)

Type Parameters

T

The type to activate

Parameters

argumentTypes
Type[]

The types of objects, in order, that will be passed to the returned function as its second parameter

Returns

A factory that will instantiate type T using an IServiceProvider and an argument array containing objects matching the types defined in argumentTypes

Applies to