TypeProvider.GetType 方法

定义

Type从通过搜索所添加的程序集引用和代码编译单元传递的限定类型名称中获取。

重载

名称 说明
GetType(String)

从添加到 usingTypeProviderAddAssembly(Assembly)、或AddAssemblyReference(String)AddCodeCompileUnit(CodeCompileUnit)程序集集中获取类型。

GetType(String, Boolean)

从添加到 usingTypeProviderAddAssembly(Assembly)、或AddAssemblyReference(String)AddCodeCompileUnit(CodeCompileUnit)程序集集中获取类型。

GetType(String)

从添加到 usingTypeProviderAddAssembly(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 为 null 引用(Visual Basic 中的 Nothing

注解

如果名称不能解析在此实例的程序集缓存和已编译的单元中,则返回 null 引用(Visual Basic Nothing)。 调用此重载与调用参数值设置为throwOnError的两个参数true重载相同。

适用于

GetType(String, Boolean)

从添加到 usingTypeProviderAddAssembly(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 为 null 引用(Visual Basic 中的 Nothing

name 是不可解析的, throwOnErrortrue

注解

如果名称不能解析在此实例的程序集和编译单元的缓存中,则返回 null 引用(Nothing);在这种情况下throwOnErrorfalse

适用于