BuildManager.GetType 方法

定義

在頂層組件或配置中定義的組件中找到型別。

多載

名稱 Description
GetType(String, Boolean)

在頂層組件或配置中定義的組件中找到型別,並在失敗時可選擇拋出例外。

GetType(String, Boolean, Boolean)

透過使用不區分大小寫的搜尋,並在失敗時可選擇拋出例外,在頂層組件或設定中定義的組件中找到型別。

備註

頂層組裝是指 Global.asax 檔案,或位於 App_GlobalResources、App_WebReferences、App_Code 或 App_Browsers 目錄中的檔案。

GetType(String, Boolean)

在頂層組件或配置中定義的組件中找到型別,並在失敗時可選擇拋出例外。

public:
 static Type ^ GetType(System::String ^ typeName, bool throwOnError);
public static Type GetType(string typeName, bool throwOnError);
static member GetType : string * bool -> Type
Public Shared Function GetType (typeName As String, throwOnError As Boolean) As Type

參數

typeName
String

類型的名稱。

throwOnError
Boolean

trueType無法產生物件,則拋出例外;否則,。 false

傳回

一個 Type 代表所 typeName 請求參數的物件。

例外狀況

typeName 無效。

-或-

typeName 是模糊不清的。

-或-

typeName 找不到,且 throwOnErrortrue

備註

頂層組裝是指 Global.asax 檔案,或位於 App_GlobalResources、App_WebReferences、App_Code 或 App_Browsers 目錄中的檔案。

適用於

GetType(String, Boolean, Boolean)

透過使用不區分大小寫的搜尋,並在失敗時可選擇拋出例外,在頂層組件或設定中定義的組件中找到型別。

public:
 static Type ^ GetType(System::String ^ typeName, bool throwOnError, bool ignoreCase);
public static Type GetType(string typeName, bool throwOnError, bool ignoreCase);
static member GetType : string * bool * bool -> Type
Public Shared Function GetType (typeName As String, throwOnError As Boolean, ignoreCase As Boolean) As Type

參數

typeName
String

類型的名稱。

throwOnError
Boolean

true若無法為型別名稱產生 a Type ,則拋出例外;否則,。 false

ignoreCase
Boolean

truetypeName 是區分大小寫;否則 。 false

傳回

一個 Type 代表所 typeName 請求參數的物件。

例外狀況

typeName 無效。

-或-

typeName 是模糊不清的。

-或-

typeName 找不到,且 throwOnErrortrue

備註

頂層組裝是指 Global.asax 檔案,或位於 App_GlobalResources、App_WebReferences、App_Code 或 App_Browsers 目錄中的檔案。

適用於