Mono Class Library: System.Type Overview | Members

System.Type.GetType Method

Returns the Type with the specified name.

public static Type GetType (string typeName)

Parameters

typeName
A string containing the case-sensitive name of the Type to return.

Returns

The Type with the specified name, if found; otherwise, null. If the requested type is non-public and the caller does not have permission to reflect non-public objects outside the current assembly, this method returns null.

Permissions

TypeReason
System.Security.Permissions.ReflectionPermissionRequires permission to retrieve information on non-public members of types in loaded assemblies. See System.Security.Permissions.ReflectionPermissionFlag.TypeInformation.

Exceptions

TypeReason
ArgumentNullExceptiontypeName is null.
System.Reflection.TargetInvocationExceptionA type initializer was invoked and threw an exception.

Remarks

This method is equivalent to Type.GetType(string, bool, bool)(name, false, false).

typeName can be a simple type name, a type name that includes a namespace, or a complex name that includes an assembly name specification. If typeName includes only the name of the Type, this method searches in the calling object's assembly, then in the mscorlib.dll assembly. If typeName is fully qualified with the partial or complete assembly name, this method searches in the specified assembly.

Note: Type.AssemblyQualifiedName can return a fully qualified type name including nested types, the assembly name, and generic type arguments. For complete details, see Type.GetType(string, bool, bool)(string, bool, bool).

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0