ActivatorUtilities.CreateFactory Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
CreateFactory(Type, Type[]) |
Creates a delegate that will instantiate a type with constructor arguments provided directly and/or from an IServiceProvider. |
CreateFactory<T>(Type[]) |
Creates a delegate that will instantiate a type with constructor arguments provided directly and/or from an IServiceProvider. |
- Source:
- ActivatorUtilities.cs
- Source:
- ActivatorUtilities.cs
- Source:
- ActivatorUtilities.cs
Creates 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
A factory that will instantiate instanceType using an IServiceProvider and an argument array containing objects matching the types defined in argumentTypes.
Applies to
.NET 10 (package-provided) an aner Versiounen
Produkt | Versiounen |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided) |
.NET Standard | 2.0 (package-provided), 2.1 (package-provided) |
- Source:
- ActivatorUtilities.cs
- Source:
- ActivatorUtilities.cs
- Source:
- ActivatorUtilities.cs
Creates a delegate that will instantiate a type with constructor arguments provided directly and/or from an 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)
Type Parameters
- T
The type to activate.
Parameters
- argumentTypes
- Type[]
The types of objects, in order, that will be passed to the returned function as its second parameter.
Returns
A factory that will instantiate type T
using an IServiceProvider
and an argument array containing objects matching the types defined in argumentTypes
.
Applies to
.NET 10 (package-provided) an aner Versiounen
Produkt | Versiounen |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided) |
.NET Standard | 2.0 (package-provided), 2.1 (package-provided) |
Feedback zu .NET
.NET ass en Open-Source-Projet. Wielt e Link, fir Feedback ze ginn: