ActivatorUtilities Class

Definition

Helper code for the various activator services.

C#
public static class ActivatorUtilities
Inheritance
ActivatorUtilities

Methods

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.

CreateInstance(IServiceProvider, Type, Object[])

Instantiates a type with constructor arguments provided directly and/or from an IServiceProvider.

CreateInstance<T>(IServiceProvider, Object[])

Instantiates a type with constructor arguments provided directly and/or from an IServiceProvider.

GetServiceOrCreateInstance(IServiceProvider, Type)

Retrieve an instance of the given type from the service provider. If one is not found then instantiate it directly.

GetServiceOrCreateInstance<T>(IServiceProvider)

Retrieve an instance of the given type from the service provider. If one is not found then instantiate it directly.

Applies to

Produk Versi
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)