NAnt SDK Documentation - v0.92

ReflectionUtils.GetTypeFromString Method 

Loads the type specified in the type string with assembly qualified name.

[Visual Basic]
Public Shared Function GetTypeFromString( _
   ByVal typeName As String, _
   ByVal throwOnError As Boolean _
) As Type
[C#]
public static Type GetTypeFromString(
   string typeName,
   bool throwOnError
);

Parameters

typeName
The assembly qualified name of the type to load.
throwOnError
Flag set to true to throw an exception if the type cannot be loaded.

Return Value

The type loaded or a null reference (Nothing in Visual Basic) if it could not be loaded.

Remarks

If the Type cannot be instantiated from the assembly qualified type name, then we'll try to instantiate the type using its simple type name from an already loaded assembly with an assembly name mathing the assembly in the assembly qualified type name.

Exceptions

Exception Type Condition
TypeLoadException throwOnError is true and an error is encountered while loading the Type, or typeName is not an assembly qualified name.

See Also

ReflectionUtils Class | NAnt.Core.Util Namespace