แก้ไข

แชร์ผ่าน


BuildManager.GetType Method

Definition

Finds a type in the top-level assemblies or in assemblies that are defined in configuration.

Overloads

GetType(String, Boolean)

Finds a type in the top-level assemblies or in assemblies that are defined in configuration, and optionally throws an exception on failure.

GetType(String, Boolean, Boolean)

Finds a type in the top-level assemblies, or in assemblies that are defined in configuration, by using a case-insensitive search and optionally throwing an exception on failure.

Remarks

A top-level assembly refers to the Global.asax file, or to a file that is in the App_GlobalResources, App_WebReferences, App_Code, or App_Browsers directory.

GetType(String, Boolean)

Finds a type in the top-level assemblies or in assemblies that are defined in configuration, and optionally throws an exception on failure.

public:
 static Type ^ GetType(System::String ^ typeName, bool throwOnError);
public static Type GetType (string typeName, bool throwOnError);
static member GetType : string * bool -> Type
Public Shared Function GetType (typeName As String, throwOnError As Boolean) As Type

Parameters

typeName
String

The name of the type.

throwOnError
Boolean

true to throw an exception if a Type object cannot be generated for the type name; otherwise, false.

Returns

A Type object that represents the requested typeName parameter.

Exceptions

typeName is invalid.

-or-

typeName is ambiguous.

-or-

typeName could not be found, and throwOnError is true.

Remarks

A top-level assembly refers to the Global.asax file, or to a file that is in the App_GlobalResources, App_WebReferences, App_Code, or App_Browsers directory.

Applies to

GetType(String, Boolean, Boolean)

Finds a type in the top-level assemblies, or in assemblies that are defined in configuration, by using a case-insensitive search and optionally throwing an exception on failure.

public:
 static Type ^ GetType(System::String ^ typeName, bool throwOnError, bool ignoreCase);
public static Type GetType (string typeName, bool throwOnError, bool ignoreCase);
static member GetType : string * bool * bool -> Type
Public Shared Function GetType (typeName As String, throwOnError As Boolean, ignoreCase As Boolean) As Type

Parameters

typeName
String

The name of the type.

throwOnError
Boolean

true to throw an exception if a Type cannot be generated for the type name; otherwise, false.

ignoreCase
Boolean

true if typeName is case-sensitive; otherwise, false.

Returns

A Type object that represents the requested typeName parameter.

Exceptions

typeName is invalid.

-or-

typeName is ambiguous.

-or-

typeName could not be found, and throwOnError is true.

Remarks

A top-level assembly refers to the Global.asax file, or to a file that is in the App_GlobalResources, App_WebReferences, App_Code, or App_Browsers directory.

Applies to