Show / Hide Table of Contents

Class TypeLoadingProviderExtensions

Provides a set of extension methods for ITypeLoadingProvider.

Inheritance
System.Object
TypeLoadingProviderExtensions
Namespace: System.Reflection
Assembly: Nuqleon.Reflection.Virtualization.dll
Syntax
public static class TypeLoadingProviderExtensions : Object

Methods

GetType(ITypeLoadingProvider, String)

Gets the System.Type with the specified name, performing a case-sensitive search.

Declaration
public static Type GetType(this ITypeLoadingProvider provider, string typeName)
Parameters
Type Name Description
ITypeLoadingProvider provider

The reflection provider.

System.String typeName

The assembly-qualified name of the type to get. See System.Type.AssemblyQualifiedName. If the type is in the currently executing assembly or in Mscorlib.dll, it is sufficient to supply the type name qualified by its namespace.

Returns
Type Description
System.Type

The type with the specified name, if found; otherwise, null.

GetType(ITypeLoadingProvider, String, Boolean)

Gets the System.Type with the specified name, performing a case-sensitive search and specifying whether to throw an exception if the type is not found.

Declaration
public static Type GetType(this ITypeLoadingProvider provider, string typeName, bool throwOnError)
Parameters
Type Name Description
ITypeLoadingProvider provider

The reflection provider.

System.String typeName

The assembly-qualified name of the type to get. See System.Type.AssemblyQualifiedName. If the type is in the currently executing assembly or in Mscorlib.dll, it is sufficient to supply the type name qualified by its namespace.

System.Boolean throwOnError

true to throw an exception if the type cannot be found; false to return null. Specifying false also suppresses some other exception conditions, but not all of them. See the Exceptions section.

Returns
Type Description
System.Type

The type with the specified name. If the type is not found, the throwOnError parameter specifies whether null is returned or an exception is thrown. In some cases, an exception is thrown regardless of the value of throwOnError. See the Exceptions section.

GetType(ITypeLoadingProvider, String, Func<AssemblyName, Assembly>, Func<Assembly, String, Boolean, Type>)

Gets the type with the specified name, optionally providing custom methods to resolve the assembly and the type.

Declaration
public static Type GetType(this ITypeLoadingProvider provider, string typeName, Func<AssemblyName, Assembly> assemblyResolver, Func<Assembly, string, bool, Type> typeResolver)
Parameters
Type Name Description
ITypeLoadingProvider provider

The reflection provider.

System.String typeName

The name of the type to get. If the typeResolver parameter is provided, the type name can be any string that typeResolver is capable of resolving. If the assemblyResolver parameter is provided or if standard type resolution is used, typeName must be an assembly-qualified name (see System.Type.AssemblyQualifiedName), unless the type is in the currently executing assembly or in Mscorlib.dll, in which case it is sufficient to supply the type name qualified by its namespace.

System.Func<System.Reflection.AssemblyName, System.Reflection.Assembly> assemblyResolver

A method that locates and returns the assembly that is specified in typeName. The assembly name is passed to assemblyResolver as an System.Reflection.AssemblyName object. If typeName does not contain the name of an assembly, assemblyResolver is not called. If assemblyResolver is not supplied, standard assembly resolution is performed. Caution Do not pass methods from unknown or untrusted callers. Doing so could result in elevation of privilege for malicious code. Use only methods that you provide or that you are familiar with.

System.Func<System.Reflection.Assembly, System.String, System.Boolean, System.Type> typeResolver

A method that locates and returns the type that is specified by typeName from the assembly that is returned by assemblyResolver or by standard assembly resolution. If no assembly is provided, the typeResolver method can provide one. The method also takes a parameter that specifies whether to perform a case-insensitive search; false is passed to that parameter. Caution Do not pass methods from unknown or untrusted callers.

Returns
Type Description
System.Type

The type with the specified name, or null if the type is not found.

GetType(ITypeLoadingProvider, String, Func<AssemblyName, Assembly>, Func<Assembly, String, Boolean, Type>, Boolean)

Gets the type with the specified name, specifying whether to throw an exception if the type is not found, and optionally providing custom methods to resolve the assembly and the type.

Declaration
public static Type GetType(this ITypeLoadingProvider provider, string typeName, Func<AssemblyName, Assembly> assemblyResolver, Func<Assembly, string, bool, Type> typeResolver, bool throwOnError)
Parameters
Type Name Description
ITypeLoadingProvider provider

The reflection provider.

System.String typeName

The name of the type to get. If the typeResolver parameter is provided, the type name can be any string that typeResolver is capable of resolving. If the assemblyResolver parameter is provided or if standard type resolution is used, typeName must be an assembly-qualified name (see System.Type.AssemblyQualifiedName), unless the type is in the currently executing assembly or in Mscorlib.dll, in which case it is sufficient to supply the type name qualified by its namespace.

System.Func<System.Reflection.AssemblyName, System.Reflection.Assembly> assemblyResolver

A method that locates and returns the assembly that is specified in typeName. The assembly name is passed to assemblyResolver as an System.Reflection.AssemblyName object. If typeName does not contain the name of an assembly, assemblyResolver is not called. If assemblyResolver is not supplied, standard assembly resolution is performed. Caution Do not pass methods from unknown or untrusted callers. Doing so could result in elevation of privilege for malicious code. Use only methods that you provide or that you are familiar with.

System.Func<System.Reflection.Assembly, System.String, System.Boolean, System.Type> typeResolver

A method that locates and returns the type that is specified by typeName from the assembly that is returned by assemblyResolver or by standard assembly resolution. If no assembly is provided, the method can provide one. The method also takes a parameter that specifies whether to perform a case-insensitive search; false is passed to that parameter. Caution Do not pass methods from unknown or untrusted callers.

System.Boolean throwOnError

true to throw an exception if the type cannot be found; false to return null. Specifying false also suppresses some other exception conditions, but not all of them. See the Exceptions section.

Returns
Type Description
System.Type

The type with the specified name. If the type is not found, the throwOnError parameter specifies whether null is returned or an exception is thrown. In some cases, an exception is thrown regardless of the value of throwOnError. See the Exceptions section.

In This Article
Back to top Generated by DocFX