Assembly.GetType Method (String) (System.Reflection)

Switch View :
ScriptFree
.NET Framework Class Library
Assembly.GetType Method (String)

Updated: July 2010

Gets the Type object with the specified name in the assembly instance.

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

Visual Basic
Public Overridable Function GetType ( _
	name As String _
) As Type
C#
public virtual Type GetType(
	string name
)
Visual C++
public:
virtual Type^ GetType(
	String^ name
)
F#
abstract GetType : 
        name:string -> Type 
override GetType : 
        name:string -> Type 

Parameters

name
Type: System.String
The full name of the type.

Return Value

Type: System.Type
An object that represents the specified class, or null if the class is not found.

Implements

_Assembly.GetType(String)
Exceptions

Exception Condition
ArgumentException

name is invalid.

ArgumentNullException

name is null.

FileNotFoundException

name requires a dependent assembly that could not be found.

FileLoadException

name requires a dependent assembly that was found but could not be loaded.

-or-

The current assembly was loaded into the reflection-only context, and name requires a dependent assembly that was not preloaded.

BadImageFormatException

name requires a dependent assembly, but the file is not a valid assembly.

-or-

name requires a dependent assembly which was compiled for a version of the runtime later than the currently loaded version.

Remarks

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(String) method overload, which can optionally include an assembly display name as part of the type name.

Note Note

If the type has been forwarded to another assembly, it is still returned by this method. For information on type forwarding, see Type Forwarding in the Common Language Runtime.

Version Information

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library
Platforms

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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

Reference

Change History

Date

History

Reason

July 2010

Removed obsolete permission.

Customer feedback.