Reflection Only Get Type(String, Boolean, Boolean) Method
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.
public: static Type ^ ReflectionOnlyGetType(System::String ^ typeName, bool throwIfNotFound, bool ignoreCase);
public static Type ReflectionOnlyGetType (string typeName, bool throwIfNotFound, bool ignoreCase);
static member ReflectionOnlyGetType : string * bool * bool -> Type
Public Shared Function ReflectionOnlyGetType (typeName As String, throwIfNotFound As Boolean, ignoreCase As Boolean) As Type
true to throw a TypeLoadException if the type cannot be found;
false to return
null if the type cannot be found. Specifying
false also suppresses some other exception conditions, but not all of them. See the Exceptions section.
true to perform a case-insensitive search for
false to perform a case-sensitive search for
The type with the specified name, if found; otherwise,
null. If the type is not found, the
throwIfNotFound parameter specifies whether
null is returned or an exception is thrown. In some cases, an exception is thrown regardless of the value of
throwIfNotFound. See the Exceptions section.
A class initializer is invoked and throws an exception.
true and the type is not found.
typeName contains invalid characters, such as an embedded tab.
typeName is an empty string.
typeName represents an array type with an invalid size.
typeName represents an array of TypedReference objects.
typeName does not include the assembly name.
typeName contains invalid syntax; for example, "MyType[,*,]".
typeName represents a generic type that has a pointer type, a
ByRef type, or Void as one of its type arguments.
typeName represents a generic type that has an incorrect number of type arguments.
typeName represents a generic type, and one of its type arguments does not satisfy the constraints for the corresponding type parameter.
true and the assembly or one of its dependencies was not found.
The assembly or one of its dependencies was found, but could not be loaded.
The assembly or one of its dependencies is not valid.
The assembly was compiled with a later version of the common language runtime than the version that is currently loaded.
.NET Core only: This member is not supported.
If the assembly containing the type is not already loaded into the reflection-only context, 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 Assembly.GetType method. For information about assembly-qualified names, see the Type.AssemblyQualifiedName property. For additional 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.
throwIfNotFound parameter specifies what happens when the type is not found, and also suppresses certain other exception conditions, as described in the Exceptions section. Some exceptions are thrown regardless of the value of
throwIfNotFound. For example, if the assembly is not valid, a BadImageFormatException is thrown even if
For more information about using the reflection-only context, see How to: Load Assemblies into the Reflection-Only Context.