Assembly.GetType Method (String, Boolean, Boolean)

Gets the Type object with the specified name in the assembly instance, with the options of ignoring the case, and of throwing an exception if the type is not found.

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)

public Type GetType (
	string name,
	bool throwOnError,
	bool ignoreCase
public final Type GetType (
	String name, 
	boolean throwOnError, 
	boolean ignoreCase
public final function GetType (
	name : String, 
	throwOnError : boolean, 
	ignoreCase : boolean
) : Type



The full name of the type.


true to throw an exception if the type is not found; false to return a null reference (Nothing in Visual Basic).


true to ignore the case of the type name; otherwise, false.

Return Value

A Type object that represents the specified class.

Exception typeCondition


The type is not in the assembly instance you are calling the method on.


name is invalid.


The length of name exceeds 1024 characters.


name is a null reference (Nothing in Visual Basic).


throwOnError is true, and the type cannot be found.

This method only searches the current assembly instance. The name parameter includes the namespace but not the assembly. To search other assemblies for a type, use the Type.GetType method overload, which can optionally include an assembly display name as part of the type name.

The throwOnError parameter only affects what happens when the type is not found. It does not affect any other exceptions that might be thrown. In particular, if the type is found but cannot be loaded, TypeLoadException can be thrown even if throwOnError is false.

  • ReflectionPermission  when invoked late-bound through mechanisms such as Type.InvokeMember. Associated enumeration: ReflectionPermissionFlag.MemberAccess.
  • ReflectionPermission  for reflecting types that are not publicly visible. Associated enumerations: ReflectionPermissionFlag.MemberAccess, ReflectionPermissionFlag.TypeInformation

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0