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(string typeName, bool throwOnError);

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

.NET Framework 4.8.1 a další verze
Produkt Verze
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

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(string typeName, bool throwOnError, bool ignoreCase);

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

.NET Framework 4.8.1 a další verze
Produkt Verze
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1