TypeProvider.GetType Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the Type from the qualified type name passed by searching through the assembly references and code compile units that are added.
Overloads
GetType(String) |
Gets the type from the set of assemblies added to the |
GetType(String, Boolean) |
Gets the type from the set of assemblies added to the |
GetType(String)
Gets the type from the set of assemblies added to the TypeProvider
using AddAssembly(Assembly), AddAssemblyReference(String), or 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
Parameters
- name
- String
The type name.
Returns
The requested Type.
Implements
Exceptions
name
is a null reference (Nothing
in Visual Basic)
Remarks
If the name is not resolvable within the cache of assemblies and compiled units of this instance, a null reference (Visual Basic Nothing
) is returned. Invoking this overload is the same as invoking the two parameter overloads with the value of the parameter throwOnError
set to true
.
Applies to
GetType(String, Boolean)
Gets the type from the set of assemblies added to the TypeProvider
using AddAssembly(Assembly), AddAssemblyReference(String), or 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
Parameters
- name
- String
The type name.
- throwOnError
- Boolean
A value that indicates whether to throw an exception if name
is not resolvable.
Returns
The requested Type.
Implements
Exceptions
name
is a null reference (Nothing
in Visual Basic)
name
is not resolvable and throwOnError
is true
.
Remarks
If the name is not resolvable within the cache of assemblies and compiled units of this instance, a null reference (Nothing
) is returned; in the case that throwOnError
is false
.
Applies to
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應