ActivatorUtilities 类

定义

用于各种激活器服务的帮助程序代码。Helper code for the various activator services.

public ref class ActivatorUtilities abstract sealed
public static class ActivatorUtilities
type ActivatorUtilities = class
Public Class ActivatorUtilities
继承
ActivatorUtilities

方法

CreateFactory(Type, Type[])

创建一个委托,该委托将使用直接和/或从 IServiceProvider 提供的构造函数参数实例化类型。Create a delegate that will instantiate a type with constructor arguments provided directly and/or from an IServiceProvider.

CreateInstance(IServiceProvider, Type, Object[])

使用直接和/或从 IServiceProvider 提供的构造函数参数实例化类型。Instantiate a type with constructor arguments provided directly and/or from an IServiceProvider.

CreateInstance<T>(IServiceProvider, Object[])

使用直接和/或从 IServiceProvider 提供的构造函数参数实例化类型。Instantiate 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.

适用于