TypeProvider.GetType 方法

定義

從透過搜尋加入之組件參考和程式碼編譯單位所傳遞的限定型別名稱中,取得 Type

多載

GetType(String)

使用 TypeProviderAddAssembly(Assembly)AddAssemblyReference(String),從加入到 AddCodeCompileUnit(CodeCompileUnit) 的組件集中取得型別。

GetType(String, Boolean)

使用 TypeProviderAddAssembly(Assembly)AddAssemblyReference(String),從加入到 AddCodeCompileUnit(CodeCompileUnit) 的組件集中取得型別。

GetType(String)

使用 TypeProviderAddAssembly(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

所要求的 Type

實作

例外狀況

name 為 null 參考 (在 Visual Basic 中為 Nothing)

備註

如果無法解析組件快取和這個執行個體之已編譯單元內的名稱,則傳回 null 參考 (在 Visual Basic 中為 Nothing)。 叫用這個多載等於叫用兩個 throwOnError 參數值設為 true 的參數多載。

適用於

GetType(String, Boolean)

使用 TypeProviderAddAssembly(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

所要求的 Type

實作

例外狀況

name 為 null 參考 (在 Visual Basic 中為 Nothing)

name 無法解析,且 throwOnErrortrue

備註

如果無法解析組件快取和這個執行個體之已編譯單元內的名稱,則傳回 null 參考 (Nothing);在此情況下,throwOnErrorfalse

適用於