Microsoft.Extensions.DependencyInjection.Abstractions by Microsoft

<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />

 ActivatorUtilities

public static class ActivatorUtilities
Helper code for the various activator services.
public static ObjectFactory CreateFactory(Type instanceType, Type[] argumentTypes)

Create a delegate that will instantiate a type with constructor arguments provided directly and/or from an IServiceProvider.

public static ObjectFactory<T> CreateFactory<T>(Type[] argumentTypes)

Create a delegate that will instantiate a type with constructor arguments provided directly and/or from an IServiceProvider.

public static object CreateInstance(IServiceProvider provider, Type instanceType, object[] parameters)

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

public static T CreateInstance<T>(IServiceProvider provider, object[] parameters)

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

public static T GetServiceOrCreateInstance<T>(IServiceProvider provider)

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

public static object GetServiceOrCreateInstance(IServiceProvider provider, Type type)

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