TypeProvider TypeProvider TypeProvider TypeProvider Class

定義

警告

此 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
[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
繼承
TypeProviderTypeProviderTypeProviderTypeProvider
屬性
實作

備註

注意

此資料討論已被汰換的類型及命名空間。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(IServiceProvider) TypeProvider(IServiceProvider) TypeProvider(IServiceProvider)

初始化 TypeProvider 類別的新執行個體。Initializes a new instance of the TypeProvider class.

屬性

AssemblyNameResolver AssemblyNameResolver AssemblyNameResolver 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 IsSupportedPropertyResolver IsSupportedPropertyResolver 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 LocalAssembly LocalAssembly LocalAssembly

取得值,這個值表示為這個執行個體本機定義的 AssemblyGets a value that represents the locally defined Assembly for this instance.

ReferencedAssemblies ReferencedAssemblies ReferencedAssemblies ReferencedAssemblies

取得由 Type 參考的所有組件集合。Gets a collection of all assemblies referenced by the Type.

TypeLoadErrors TypeLoadErrors TypeLoadErrors TypeLoadErrors

取得載入錯誤例外狀況的 IDictionary,該例外狀況由導致 ObjectException 做為索引鍵。Gets an IDictionary of load error exceptions keyed by the Object that causes the Exception.

方法

AddAssembly(Assembly) AddAssembly(Assembly) AddAssembly(Assembly) 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) AddAssemblyReference(String) AddAssemblyReference(String) 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) AddCodeCompileUnit(CodeCompileUnit) AddCodeCompileUnit(CodeCompileUnit) 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() Dispose() Dispose() Dispose()

釋放 TypeProvider 所使用的所有資源。Releases all resources used by the TypeProvider.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetAssemblyName(Type) GetAssemblyName(Type) GetAssemblyName(Type) GetAssemblyName(Type)

傳回指定型別宣告所在組件的顯示名稱。Returns the assembly display name of the assembly in which the specified type is declared.

GetEnumNames(Type) GetEnumNames(Type) GetEnumNames(Type) GetEnumNames(Type)

提供字串陣列,其中包含以索引順序指定的 Enum 名稱。Provides a string array that contains the names for the specified Enum in indexed order.

GetEventHandlerType(EventInfo) GetEventHandlerType(EventInfo) GetEventHandlerType(EventInfo) GetEventHandlerType(EventInfo)

取得 TypeEventHandler (參考 EventInfo)。Gets the Type of an EventHandler, given a reference to an EventInfo.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetService(Type) GetService(Type) GetService(Type) GetService(Type)

取得 Object,此物件會提供指定的 Type 服務。Gets the Object that provides the designated service Type.

GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
GetType(String) GetType(String) GetType(String) 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) GetType(String, Boolean) GetType(String, Boolean) 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() GetTypes() GetTypes() GetTypes()

建立陣列,其中包含公開給這個執行個體的每個 TypeCreates an array that contains each Type known to this instance.

IsAssignable(Type, Type) IsAssignable(Type, Type) IsAssignable(Type, Type) IsAssignable(Type, Type)

指出是否安全地將一個型別指派至另一個型別。Indicates whether one type can be safely assigned to another type.

IsEnum(Type) IsEnum(Type) IsEnum(Type) IsEnum(Type)

指示 Type 的型別是否為 EnumIndicates whether a Type is of type Enum .

IsSubclassOf(Type, Type) IsSubclassOf(Type, Type) IsSubclassOf(Type, Type) IsSubclassOf(Type, Type)

指出 Type 是否為另一個 Type 的衍生類別。Indicates whether a Type is a derived class of another Type .

IsSupportedProperty(PropertyInfo, Object) IsSupportedProperty(PropertyInfo, Object) IsSupportedProperty(PropertyInfo, Object) 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() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
RefreshCodeCompileUnit(CodeCompileUnit, EventHandler) RefreshCodeCompileUnit(CodeCompileUnit, EventHandler) RefreshCodeCompileUnit(CodeCompileUnit, EventHandler) RefreshCodeCompileUnit(CodeCompileUnit, EventHandler)

更新與這個執行個體相關聯的 CodeCompileUnit 參考。Updates the CodeCompileUnit reference associated with this instance.

RemoveAssembly(Assembly) RemoveAssembly(Assembly) RemoveAssembly(Assembly) RemoveAssembly(Assembly)

將所有對 Assembly 主體的參考從這個執行個體中移除。Removes all references to the subject Assembly from this instance.

RemoveAssemblyReference(String) RemoveAssemblyReference(String) RemoveAssemblyReference(String) RemoveAssemblyReference(String)

將路徑架構的 Assembly 參考從這個執行個體中移除。Removes a path-based Assembly reference from this instance.

RemoveCodeCompileUnit(CodeCompileUnit) RemoveCodeCompileUnit(CodeCompileUnit) RemoveCodeCompileUnit(CodeCompileUnit) RemoveCodeCompileUnit(CodeCompileUnit)

將所有對 CodeCompileUnit 主體的參考從這個執行個體中移除。Removes all references to the subject CodeCompileUnit from this instance.

SetLocalAssembly(Assembly) SetLocalAssembly(Assembly) SetLocalAssembly(Assembly) SetLocalAssembly(Assembly)

將本機 Assembly 的值設定為所參考的 AssemblySets the value of the local Assembly to the referenced Assembly .

ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

事件

TypeLoadErrorsChanged TypeLoadErrorsChanged TypeLoadErrorsChanged TypeLoadErrorsChanged

在修改 TypeLoadErrors 集合時發生。Occurs when the collection TypeLoadErrors is modified.

TypesChanged TypesChanged TypesChanged TypesChanged

在修改已定義型別的集合時發生。Occurs when the collection of defined types is modified.

適用於