NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Type.GetType (String, Boolean)

Gets the Type with the specified name, performing a case-sensitive search and specifying 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 _
) As Type
[C#]
public static Type GetType(
   string typeName,
   bool throwOnError
);
[C++]
public: static Type* GetType(
   String* typeName,
   bool throwOnError
);
[JScript]
public static function GetType(
   typeName : String,
   throwOnError : Boolean
) : Type;

Parameters

typeName
The name of the Type to get.
throwOnError
true to throw a TypeLoadException on error while loading the Type.

-or-

false to ignore errors while loading the Type.

Return Value

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

Exceptions

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.

Remarks

The search for typeName is case-sensitive.

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.

See Also

Type Class | Type Members | System Namespace | Type.GetType Overload List | AssemblyQualifiedName | GetAssembly | GetType