ITypeResolutionService.GetType 方法
定义
用指定的名称加载类型。Loads a type with the specified name.
重载
| GetType(String) |
用指定的名称加载类型。Loads a type with the specified name. |
| GetType(String, Boolean) |
用指定的名称加载类型。Loads a type with the specified name. |
| GetType(String, Boolean, Boolean) |
用指定的名称加载类型。Loads a type with the specified name. |
GetType(String)
用指定的名称加载类型。Loads a type with the specified name.
public:
Type ^ GetType(System::String ^ name);
public Type GetType (string name);
abstract member GetType : string -> Type
Public Function GetType (name As String) As Type
参数
- name
- String
类型的名称。The name of the type. 如果类型名不是指示程序集的完全限定名,则此服务将搜索其引用的程序集的内部集合。If the type name is not a fully qualified name that indicates an assembly, this service will search its internal set of referenced assemblies.
返回
与指定名称对应的 Type 的实例,或者如果找不到任何类型,则为 null。An instance of Type that corresponds to the specified name, or null if no type can be found.
适用于
GetType(String, Boolean)
用指定的名称加载类型。Loads a type with the specified name.
public:
Type ^ GetType(System::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
类型的名称。The name of the type. 如果类型名不是指示程序集的完全限定名,则此服务将搜索其引用的程序集的内部集合。If the type name is not a fully qualified name that indicates an assembly, this service will search its internal set of referenced assemblies.
- throwOnError
- Boolean
如果在无法找到程序集时此方法应引发异常,则为 true;否则为 false,而且当无法找到程序集时,此方法将返回 null。true if this method should throw an exception if the assembly cannot be located; otherwise, false, and this method returns null if the assembly cannot be located.
返回
与指定名称对应的 Type 的实例,或者如果找不到任何类型,则为 null。An instance of Type that corresponds to the specified name, or null if no type can be found.
注解
如果无法加载该类型,并且 throwOnError 参数为 true ,则将引发异常。If the type cannot be loaded and the throwOnError parameter is true, this will throw an exception.
适用于
GetType(String, Boolean, Boolean)
用指定的名称加载类型。Loads a type with the specified name.
public:
Type ^ GetType(System::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
类型的名称。The name of the type. 如果类型名不是指示程序集的完全限定名,则此服务将搜索其引用的程序集的内部集合。If the type name is not a fully qualified name that indicates an assembly, this service will search its internal set of referenced assemblies.
- throwOnError
- Boolean
如果在无法找到程序集时此方法应引发异常,则为 true;否则为 false,而且当无法找到程序集时,此方法将返回 null。true if this method should throw an exception if the assembly cannot be located; otherwise, false, and this method returns null if the assembly cannot be located.
- ignoreCase
- Boolean
如果为 true,则在搜索类型时忽略大小写;否则为 false。true to ignore case when searching for types; otherwise, false.
返回
与指定名称对应的 Type 的实例,或者如果找不到任何类型,则为 null。An instance of Type that corresponds to the specified name, or null if no type can be found.
注解
如果无法加载该类型,并且 throwOnError 参数为 true ,则将引发异常。If the type cannot be loaded and the throwOnError parameter is true, this will throw an exception.