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[]

物件類型,依序傳遞至傳回的函式做為其第二個參數。

傳回

使用 IServiceProvider 和自變數數位具現化類型 T 的處理站,其中包含符合 argumentTypes中所定義型別的物件。

適用於