TypeProvider.GetType 方法

定義

透過 Type 搜尋新增的組合語言參考和程式碼編譯單元,取得合格型別名稱。

多載

名稱 Description
GetType(String)

從使用 、 TypeProvider、 或 AddAssembly(Assembly)加入的AddAssemblyReference(String)AddCodeCompileUnit(CodeCompileUnit)組裝集合中取得型別。

GetType(String, Boolean)

從使用 、 TypeProvider、 或 AddAssembly(Assembly)加入的AddAssemblyReference(String)AddCodeCompileUnit(CodeCompileUnit)組裝集合中取得型別。

GetType(String)

從使用 、 TypeProvider、 或 AddAssembly(Assembly)加入的AddAssemblyReference(String)AddCodeCompileUnit(CodeCompileUnit)組裝集合中取得型別。

public:
 virtual Type ^ GetType(System::String ^ name);
public Type GetType(string name);
override this.GetType : string -> Type
Public Function GetType (name As String) As Type

參數

name
String

類型名稱。

傳回

請求 Type的。

實作

例外狀況

name 是空參考(Nothing 在 Visual Basic中)

備註

若該名稱無法在該實例的組合語言與編譯單元快取中解析,則會回傳一個空參考(Visual Basic Nothing)。 呼叫此超載等同於將參數 throwOnError 值設為 true的同時呼叫兩個參數超載。

適用於

GetType(String, Boolean)

從使用 、 TypeProvider、 或 AddAssembly(Assembly)加入的AddAssemblyReference(String)AddCodeCompileUnit(CodeCompileUnit)組裝集合中取得型別。

public:
 virtual Type ^ GetType(System::String ^ name, bool throwOnError);
public Type GetType(string name, bool throwOnError);
override this.GetType : string * bool -> Type
Public Function GetType (name As String, throwOnError As Boolean) As Type

參數

name
String

類型名稱。

throwOnError
Boolean

一個表示若無法解決時是否拋出例外 name 的值。

傳回

請求 Type的。

實作

例外狀況

name 是空參考(Nothing 在 Visual Basic中)

name 不可解析,且 throwOnErrortrue

備註

若該名稱無法在該實例的組合語言與編譯單元快取中解析,則會回傳一個空參考(Nothing);若為 throwOnError ,則為 false

適用於