ActivatorUtilities.CreateFactory 方法

定義

多載

CreateFactory(Type, Type[])

建立將會使用直接和/或從 IServiceProvider 所提供建構函式參數將類型具現化的委派。

CreateFactory<T>(Type[])

建立委派,此委派會具現化型別,其中包含直接或從 IServiceProvider提供的建構函式自變數。

CreateFactory(Type, Type[])

來源:
ActivatorUtilities.cs
來源:
ActivatorUtilities.cs
來源:
ActivatorUtilities.cs
來源:
ActivatorUtilities.cs
來源:
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[])

來源:
ActivatorUtilities.cs
來源:
ActivatorUtilities.cs
來源:
ActivatorUtilities.cs
來源:
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定義之型別的物件。

適用於