Edita

Comparteix a través de


TypeProvider.GetType Method

Definition

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 TypeProvider using AddAssembly(Assembly), AddAssemblyReference(String), or AddCodeCompileUnit(CodeCompileUnit).

GetType(String, Boolean)

Gets the type from the set of assemblies added to the TypeProvider using AddAssembly(Assembly), AddAssemblyReference(String), or AddCodeCompileUnit(CodeCompileUnit).

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