TypeProvider 类

定义

警告

此 API 现已过时。

ITypeProvider 的实现,充当指示的程序集和代码编译单元内类型的容器。An implementation of ITypeProvider that acts as a container of types within the indicated assemblies and code compile units.

public ref class TypeProvider sealed : IDisposable, IServiceProvider, System::Workflow::ComponentModel::Compiler::ITypeProvider
public sealed class TypeProvider : IDisposable, IServiceProvider, System.Workflow.ComponentModel.Compiler.ITypeProvider
[System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
public sealed class TypeProvider : IDisposable, IServiceProvider, System.Workflow.ComponentModel.Compiler.ITypeProvider
type TypeProvider = class
    interface ITypeProvider
    interface IServiceProvider
    interface IDisposable
Public NotInheritable Class TypeProvider
Implements IDisposable, IServiceProvider, ITypeProvider
继承
TypeProvider
属性
实现

注解

备注

本材料讨论的类型和命名空间已废弃不用。This material discusses types and namespaces that are obsolete. 有关详细信息,请参阅 Windows Workflow Foundation 4.5 中弃用的类型For more information, see Deprecated Types in Windows Workflow Foundation 4.5.

除了处理已编译的程序集(ITypeProviderAddAssembly 方法)外,此 AddAssemblyReference 实现还可以处理尚未编译的类型 (AddCodeCompileUnit)。This ITypeProvider implementation, in addition to handling compiled assemblies (AddAssembly and AddAssemblyReference methods), can handle types that have not been compiled yet (AddCodeCompileUnit). 将为使用 System.Type 引用的类型返回 CodeCompileUnit 的受限实现。The limited implementation of System.Type is returned for types referenced using CodeCompileUnit.

备注

TypeProvider 从引用程序集中仅返回公共类型,而从本地程序集中同时返回公共类型和非公共类型。TypeProvider only returns public types from referenced assemblies, and both public and non-public types from local assemblies.

构造函数

TypeProvider(IServiceProvider)

初始化 TypeProvider 类的新实例。Initializes a new instance of the TypeProvider class.

属性

AssemblyNameResolver

获取或设置引用包含一个参数和一个返回值的方法的委托,该方法返回指定类型所属的程序集显示名称。Gets or sets the delegate that references a method with one parameter and one return value that returns the assembly display name in which a specified type belongs to.

IsSupportedPropertyResolver

获取或设置引用包含两个参数和一个返回值的方法的委托,该方法确定是否在目标 .NET Framework.NET Framework 中支持指定的属性。Gets or sets the delegate that references a method with two parameters and one return value that determines whether a specified property is supported in the target .NET Framework.NET Framework.

LocalAssembly

获取一个值,该值表示在本地为此实例定义的 AssemblyGets a value that represents the locally defined Assembly for this instance.

ReferencedAssemblies

获取由 Type 引用的所有程序集的集合。Gets a collection of all assemblies referenced by the Type.

TypeLoadErrors

获取由导致 IDictionaryObject 键控的加载错误异常的 ExceptionGets an IDictionary of load error exceptions keyed by the Object that causes the Exception.

方法

AddAssembly(Assembly)

添加已经加载的程序集。Adds an already-loaded assembly. 调用方负责加载程序集,而且 TypeProvider 包括此程序集中的类型以便在调用 GetType 时进行分配。It is the caller's responsibility to load the assembly, and TypeProvider includes the types from this assembly for dispensing when GetType is called.

AddAssemblyReference(String)

将对 Assembly 的引用添加到内部列表。Adds a reference to the Assembly to the internal list. 此程序集用于在 Type 方法中查找 GetType(String)This assembly is used for the Type lookup in the GetType(String) method.

AddCodeCompileUnit(CodeCompileUnit)

将对 CodeCompileUnit 的引用添加到内部列表。Adds a reference to the CodeCompileUnit to the internal list. CodeCompileUnit 用于在 Type 方法中查找 GetType(String)This CodeCompileUnit is used for the Type lookup in the GetType(String) method.

Dispose()

释放由 TypeProvider 使用的所有资源。Releases all resources used by the TypeProvider.

Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetAssemblyName(Type)

返回在其中声明指定类型的程序集的程序集显示名称。Returns the assembly display name of the assembly in which the specified type is declared.

GetEnumNames(Type)

提供一个字符串数组,其中包含指定的 Enum 的名称并按索引顺序排列。Provides a string array that contains the names for the specified Enum in indexed order.

GetEventHandlerType(EventInfo)

如果提供对 Type 的引用,则获取 EventHandlerEventInfoGets the Type of an EventHandler, given a reference to an EventInfo.

GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetService(Type)

获取提供指定服务 ObjectTypeGets the Object that provides the designated service Type.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
GetType(String)

从使用 AddAssembly(Assembly)AddAssemblyReference(String)AddCodeCompileUnit(CodeCompileUnit) 添加到 TypeProvider 的一组程序集中获取类型。Gets the type from the set of assemblies added to the TypeProvider using AddAssembly(Assembly), AddAssemblyReference(String), or AddCodeCompileUnit(CodeCompileUnit).

GetType(String, Boolean)

从使用 AddAssembly(Assembly)AddAssemblyReference(String)AddCodeCompileUnit(CodeCompileUnit) 添加到 TypeProvider 的一组程序集中获取类型。Gets the type from the set of assemblies added to the TypeProvider using AddAssembly(Assembly), AddAssemblyReference(String), or AddCodeCompileUnit(CodeCompileUnit).

GetTypes()

创建一个包含此实例已知的每个 Type 的数组。Creates an array that contains each Type known to this instance.

IsAssignable(Type, Type)

指示是否可以安全地将一个类型分配给另一个类型。Indicates whether one type can be safely assigned to another type.

IsEnum(Type)

指示 Type 的类型是否为 EnumIndicates whether a Type is of type Enum .

IsSubclassOf(Type, Type)

指示一个 Type 是否为另一个 Type 的派生类。Indicates whether a Type is a derived class of another Type .

IsSupportedProperty(PropertyInfo, Object)

返回一个值,该值确定是否在目标 .NET Framework.NET Framework 中支持指定的属性。Returns a value that determines whether the specified property is supported in the target .NET Framework.NET Framework.

MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
RefreshCodeCompileUnit(CodeCompileUnit, EventHandler)

更新与此实例关联的 CodeCompileUnit 引用。Updates the CodeCompileUnit reference associated with this instance.

RemoveAssembly(Assembly)

从此实例中移除所有对主题 Assembly 的引用。Removes all references to the subject Assembly from this instance.

RemoveAssemblyReference(String)

从此实例中移除基于路径的 Assembly 引用。Removes a path-based Assembly reference from this instance.

RemoveCodeCompileUnit(CodeCompileUnit)

从此实例中移除所有对主题 CodeCompileUnit 的引用。Removes all references to the subject CodeCompileUnit from this instance.

SetLocalAssembly(Assembly)

将本地 Assembly 的值设置为引用的 AssemblySets the value of the local Assembly to the referenced Assembly .

ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

事件

TypeLoadErrorsChanged

当修改集合 TypeLoadErrors 时发生。Occurs when the collection TypeLoadErrors is modified.

TypesChanged

在修改已定义类型的集合时发生。Occurs when the collection of defined types is modified.

适用于