Share via


ITypeResolutionService.GetType 方法

定义

用指定的名称加载类型。

重载

GetType(String)

用指定的名称加载类型。

GetType(String, Boolean)

用指定的名称加载类型。

GetType(String, Boolean, Boolean)

用指定的名称加载类型。

GetType(String)

用指定的名称加载类型。

public:
 Type ^ GetType(System::String ^ name);
public Type GetType (string name);
public Type? GetType (string name);
abstract member GetType : string -> Type
Public Function GetType (name As String) As Type

参数

name
String

类型的名称。 如果类型名不是指示程序集的完全限定名,则此服务将搜索其引用的程序集的内部集合。

返回

与指定名称对应的 Type 的实例,或者如果找不到任何类型,则为 null

适用于

GetType(String, Boolean)

用指定的名称加载类型。

public:
 Type ^ GetType(System::String ^ name, bool throwOnError);
public Type GetType (string name, bool throwOnError);
public Type? GetType (string name, bool throwOnError);
abstract member GetType : string * bool -> Type
Public Function GetType (name As String, throwOnError As Boolean) As Type

参数

name
String

类型的名称。 如果类型名不是指示程序集的完全限定名,则此服务将搜索其引用的程序集的内部集合。

throwOnError
Boolean

如果在无法找到程序集时此方法应引发异常,则为 true;否则为 false,而且当无法找到程序集时,此方法将返回 null

返回

与指定名称对应的 Type 的实例,或者如果找不到任何类型,则为 null

注解

如果无法加载类型,并且 throwOnError 参数为 true,则会引发异常。

适用于

GetType(String, Boolean, Boolean)

用指定的名称加载类型。

public:
 Type ^ GetType(System::String ^ name, bool throwOnError, bool ignoreCase);
public Type GetType (string name, bool throwOnError, bool ignoreCase);
public Type? GetType (string name, bool throwOnError, bool ignoreCase);
abstract member GetType : string * bool * bool -> Type
Public Function GetType (name As String, throwOnError As Boolean, ignoreCase As Boolean) As Type

参数

name
String

类型的名称。 如果类型名不是指示程序集的完全限定名,则此服务将搜索其引用的程序集的内部集合。

throwOnError
Boolean

如果在无法找到程序集时此方法应引发异常,则为 true;否则为 false,而且当无法找到程序集时,此方法将返回 null

ignoreCase
Boolean

如果为 true,则在搜索类型时忽略大小写;否则为 false

返回

与指定名称对应的 Type 的实例,或者如果找不到任何类型,则为 null

注解

如果无法加载类型,并且 throwOnError 参数为 true,则会引发异常。

适用于