ActivatorUtilities.CreateFactory 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| 名称 | 说明 |
|---|---|
| CreateFactory(Type, Type[]) |
创建一个委托,该委托将使用直接和/或从中 IServiceProvider提供的构造函数参数实例化类型。 |
| CreateFactory<T>(Type[]) |
创建一个委托,该委托将使用直接和/或从中 IServiceProvider提供的构造函数参数实例化类型。 |
CreateFactory(Type, Type[])
- 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[]
将作为第二个参数传递给返回的函数的对象类型(按顺序)。
返回
一个工厂,它将使用 IServiceProvider 参数数组和参数数组实例化 instanceType,其中包含与 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[]
将作为第二个参数传递给返回的函数的对象类型(按顺序)。
返回
一个工厂,它将使用一个IServiceProvider参数数组来实例化类型T,其中包含与在中argumentTypes定义的类型匹配的对象。