共用方式為


ActivatorUtilities Class

Definition

Helper code for the various activator services.

public ref class ActivatorUtilities abstract sealed
public static class ActivatorUtilities
type ActivatorUtilities = class
Public 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[])

Create 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[])

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.

Applies to