Gets the Type with the specified name, specifying whether to perform a case-sensitive search and whether to throw an exception on error while loading the Type.
[Visual Basic] Overloads Public Shared Function GetType( _ ByVal typeName As String, _ ByVal throwOnError As Boolean, _ ByVal ignoreCase As Boolean _ ) As Type [C#] public static Type GetType( string typeName, bool throwOnError, bool ignoreCase ); [C++] public: static Type* GetType( String* typeName, bool throwOnError, bool ignoreCase ); [JScript] public static function GetType( typeName : String, throwOnError : Boolean, ignoreCase : Boolean ) : Type;
-or-
false to ignore errors while loading the Type.
-or-
false to perform a case-sensitive search for typeName.
The Type with the specified name, if found; otherwise, a null reference (in Visual Basic Nothing).
Exception Type | Condition |
---|---|
ArgumentNullException | typeName is a null reference (Nothing). |
SecurityException | The requested Type is non-public and the caller does not have ReflectionPermission to reflect non-public objects outside the current assembly. |
TargetInvocationException | A class initializer is invoked and throws an exception. |
Arrays or COM types are not searched for unless they have already been loaded into the table of available classes.
If typeName includes only the name of the Type, this method searches in the calling object's assembly, then in the System assembly. If typeName is fully qualified with the partial or complete assembly name, this method searches in the specified assembly. AssemblyQualifiedName returns a fully qualified type name including the assembly name.
To obtain a Type object for an array, pass the type name followed by an open and close bracket: [].
To obtain a Type object for an n-dimensional array, include the comma character ',' within the brackets a total of n-1 times (for example, "System.Object[,,]" represents a 3-dimensional Object array).
To obtain a Type object for a jagged array, pass the type name followed by two or more bracket pairs (for example, "System.Object[][]" represents a jagged array).
If the module containing the class is not loaded, the metadata will be accessed directly without the class being loaded.
Type Class | Type Members | System Namespace | Type.GetType Overload List | AssemblyQualifiedName | GetAssembly | GetType