Type.ReflectionOnlyGetType Method

Note: This method is new in the .NET Framework version 2.0.

Gets the Type with the specified name, specifying whether to perform a case-sensitive search and whether to throw an exception if the type is not found. The type is loaded for reflection only, not for execution.

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

static Type^ ReflectionOnlyGetType (
	String^ typeName, 
	bool throwIfNotFound, 
	bool ignoreCase
public static Type ReflectionOnlyGetType (
	String typeName, 
	boolean throwIfNotFound, 
	boolean ignoreCase
public static function ReflectionOnlyGetType (
	typeName : String, 
	throwIfNotFound : boolean, 
	ignoreCase : boolean
) : Type



The name of the Type to get.


true to throw a TypeLoadException if the type cannot be found; false to return a null reference (Nothing in Visual Basic) if the type cannot be found.


true to perform a case-insensitive search for typeName; false to perform a case-sensitive search for typeName.

Return Value

The Type with the specified name, if found; otherwise, a null reference (Nothing in Visual Basic).

Exception typeCondition


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


A class initializer is invoked and throws an exception.


throwIfNotFound is true and the type is not found.


typeName is invalid, for example if it contains invalid characters, or if it is a zero-length string.

If the assembly containing the type is not already loaded into the reflection-only context, and the type is assembly-qualified, using the ReflectionOnlyGetType method is equivalent to first loading the assembly for reflection only, using the ReflectionOnlyLoad method, and then loading the type by calling the assembly's System.Reflection.Assembly.GetType method. For details on specifying type names, see the GetType(String,Boolean,Boolean) method overload.

If the assembly is already loaded for execution, another copy is loaded into the reflection-only context.

The throwIfNotFound 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 throwIfNotFound is false.

For more information about using the reflection-only context, see How to: Load Assemblies into the Reflection-Only Context.

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