ActivatorUtilities.CreateFactory(Type, Type[]) Method

Definition

Create 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

ObjectFactory
 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

.

Applies to