ActivatorUtilities.CreateFactory 方法

定义

重载

CreateFactory(Type, Type[])

创建一个委托,该委托将使用直接和/或从 IServiceProvider 提供的构造函数参数实例化类型。

CreateFactory<T>(Type[])

创建一个委托,该委托将使用直接提供的或从 提供的构造函数参数实例化类型 IServiceProvider

CreateFactory(Type, Type[])

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

创建一个委托,该委托将使用直接和/或从 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

参数

instanceType
Type

要激活的类型。

argumentTypes
Type[]

按顺序排列的对象类型,将传递给返回的函数作为其第二个参数

返回

 A factory that will instantiate instanceType using an <xref data-throw-if-not-resolved="true" uid="System.IServiceProvider"></xref>
 and an argument array containing objects matching the types defined in argumentTypes

.

适用于

CreateFactory<T>(Type[])

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

创建一个委托,该委托将使用直接提供的或从 提供的构造函数参数实例化类型 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)

类型参数

T

要激活的类型。

参数

argumentTypes
Type[]

将作为其第二个参数传递给返回函数的对象类型(按顺序排列)。

返回

使用 和参数数组实例化类型的TIServiceProvider工厂,其中包含与 中argumentTypes定义的类型匹配的对象。

适用于