Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Reflection.​Module

Assembly: System.Runtime

Inheritance: object → Module

Performs reflection on a module.

Fields and Constants

public static readonly TypeFilter
FilterTypeName
A <see langword="TypeFilter" /> object that filters the list of types defined in this module based upon the name. This field is case-sensitive and read-only.
public static readonly TypeFilter
FilterTypeNameIgnoreCase
A <see langword="TypeFilter" /> object that filters the list of types defined in this module based upon the name. This field is case-insensitive and read-only.

Properties

public Assembly
Assembly
Gets the appropriate <see cref="T:System.Reflection.Assembly" /> for this instance of <see cref="T:System.Reflection.Module" /> .
CustomAttributes
Gets a collection that contains this module's custom attributes.
public string
FullyQualifiedName
Gets a string representing the fully qualified name and path to this module.
public int
MDStreamVersion
Gets the metadata stream version.
public int
MetadataToken
Gets a token that identifies the module in metadata.
public ModuleHandle
ModuleHandle
Gets a handle for the module.
public Guid
ModuleVersionId
Gets a universally unique identifier (UUID) that can be used to distinguish between two versions of a module.
public string
Name
Gets a <see langword="String" /> representing the name of the module with the path removed.
public string
ScopeName
Gets a string representing the name of the module.

Methods

public bool
Equals​(object o)
o The object to compare with this instance.
Returns <see langword="true" /> if <paramref name="o" /> is equal to this instance; otherwise, <see langword="false" /> .
Determines whether this module and the specified object are equal.
public Type[]
FindTypes​(TypeFilter filter, object filterCriteria)
filter The delegate used to filter the classes.
filterCriteria An Object used to filter the classes.
Returns An array of type <see langword="Type" /> containing classes that were accepted by the filter.
Returns an array of classes accepted by the given filter and filter criteria.
public object[]
GetCustomAttributes​(bool inherit)
inherit This argument is ignored for objects of this type.
Returns An array of type <see langword="Object" /> containing all custom attributes.
Returns all custom attributes.
public object[]
GetCustomAttributes​(Type attributeType, bool inherit)
attributeType The type of attribute to get.
inherit This argument is ignored for objects of this type.
Returns An array of type <see langword="Object" /> containing all custom attributes of the specified type.
Gets custom attributes of the specified type.
GetCustomAttributesData​()
Returns A generic list of <see cref="T:System.Reflection.CustomAttributeData" /> objects representing data about the attributes that have been applied to the current module.
Returns a list of <see cref="T:System.Reflection.CustomAttributeData" /> objects for the current module, which can be used in the reflection-only context.
public FieldInfo
GetField​(string name)
name The field name.
Returns A <see langword="FieldInfo" /> object having the specified name, or <see langword="null" /> if the field does not exist.
Returns a field having the specified name.
public FieldInfo
GetField​(string name, BindingFlags bindingAttr)
name The field name.
bindingAttr One of the <see langword="BindingFlags" /> bit flags used to control the search.
Returns A <see langword="FieldInfo" /> object having the specified name and binding attributes, or <see langword="null" /> if the field does not exist.
Returns a field having the specified name and binding attributes.
public FieldInfo[]
GetFields​()
Returns An array of <see cref="T:System.Reflection.FieldInfo" /> objects representing the global fields defined on the module; if there are no global fields, an empty array is returned.
Returns the global fields defined on the module.
public FieldInfo[]
GetFields​(BindingFlags bindingFlags)
bindingFlags A bitwise combination of <see cref="T:System.Reflection.BindingFlags" /> values that limit the search.
Returns An array of type <see cref="T:System.Reflection.FieldInfo" /> representing the global fields defined on the module that match the specified binding flags; if no global fields match the binding flags, an empty array is returned.
Returns the global fields defined on the module that match the specified binding flags.
public int
GetHashCode​()
Returns A 32-bit signed integer hash code.
Returns the hash code for this instance.
public MethodInfo
GetMethod​(string name)
name The method name.
Returns A <see langword="MethodInfo" /> object having the specified name, or <see langword="null" /> if the method does not exist.
Returns a method having the specified name.
public MethodInfo
GetMethod​(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
name The method name.
bindingAttr One of the <see langword="BindingFlags" /> bit flags used to control the search.
binder An object that implements <see langword="Binder" /> , containing properties related to this method.
callConvention The calling convention for the method.
types The parameter types to search for.
modifiers An array of parameter modifiers used to make binding work with parameter signatures in which the types have been modified.
Returns A <see langword="MethodInfo" /> object in accordance with the specified criteria, or <see langword="null" /> if the method does not exist.
Returns a method having the specified name, binding information, calling convention, and parameter types and modifiers.
public MethodInfo
GetMethod​(string name, Type[] types)
name The method name.
types The parameter types to search for.
Returns A <see langword="MethodInfo" /> object in accordance with the specified criteria, or <see langword="null" /> if the method does not exist.
Returns a method having the specified name and parameter types.
protected MethodInfo
GetMethodImpl​(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
name The method name.
bindingAttr One of the <see langword="BindingFlags" /> bit flags used to control the search.
binder An object that implements <see langword="Binder" /> , containing properties related to this method.
callConvention The calling convention for the method.
types The parameter types to search for.
modifiers An array of parameter modifiers used to make binding work with parameter signatures in which the types have been modified.
Returns A <see langword="MethodInfo" /> object containing implementation information as specified, or <see langword="null" /> if the method does not exist.
Returns the method implementation in accordance with the specified criteria.
public MethodInfo[]
GetMethods​()
Returns An array of <see cref="T:System.Reflection.MethodInfo" /> objects representing all the global methods defined on the module; if there are no global methods, an empty array is returned.
Returns the global methods defined on the module.
public MethodInfo[]
GetMethods​(BindingFlags bindingFlags)
bindingFlags A bitwise combination of <see cref="T:System.Reflection.BindingFlags" /> values that limit the search.
Returns An array of type <see cref="T:System.Reflection.MethodInfo" /> representing the global methods defined on the module that match the specified binding flags; if no global methods match the binding flags, an empty array is returned.
Returns the global methods defined on the module that match the specified binding flags.
public void
GetObjectData​(Runtime.Serialization.SerializationInfo info, Runtime.Serialization.StreamingContext context)
info The information and data needed to serialize or deserialize an object.
context The context for the serialization.
Provides an <see cref="T:System.Runtime.Serialization.ISerializable" /> implementation for serialized objects.
public void
GetPEKind​(PortableExecutableKinds& peKind, ImageFileMachine& machine)
public Type
GetType​(string className)
className The name of the type to locate. The name must be fully qualified with the namespace.
Returns A <see langword="Type" /> object representing the given type, if the type is in this module; otherwise, <see langword="null" /> .
Returns the specified type, performing a case-sensitive search.
public Type
GetType​(string className, bool ignoreCase)
className The name of the type to locate. The name must be fully qualified with the namespace.
ignoreCase <see langword="true" /> for case-insensitive search; otherwise, <see langword="false" /> .
Returns A <see langword="Type" /> object representing the given type, if the type is in this module; otherwise, <see langword="null" /> .
Returns the specified type, searching the module with the specified case sensitivity.
public Type
GetType​(string className, bool throwOnError, bool ignoreCase)
className The name of the type to locate. The name must be fully qualified with the namespace.
throwOnError <see langword="true" /> to throw an exception if the type cannot be found; <see langword="false" /> to return <see langword="null" /> .
ignoreCase <see langword="true" /> for case-insensitive search; otherwise, <see langword="false" /> .
Returns A <see cref="T:System.Type" /> object representing the specified type, if the type is declared in this module; otherwise, <see langword="null" /> .
Returns the specified type, specifying whether to make a case-sensitive search of the module and whether to throw an exception if the type cannot be found.
public Type[]
GetTypes​()
Returns An array of type <see langword="Type" /> containing types defined within the module that is reflected by this instance.
Returns all the types defined within this module.
public bool
IsDefined​(Type attributeType, bool inherit)
attributeType The type of custom attribute to test for.
inherit This argument is ignored for objects of this type.
Returns <see langword="true" /> if one or more instances of <paramref name="attributeType" /> have been applied to this module; otherwise, <see langword="false" /> .
Returns a value that indicates whether the specified attribute type has been applied to this module.
public bool
IsResource​()
Returns <see langword="true" /> if the object is a resource; otherwise, <see langword="false" /> .
Gets a value indicating whether the object is a resource.
public FieldInfo
ResolveField​(int metadataToken)
metadataToken A metadata token that identifies a field in the module.
Returns A <see cref="T:System.Reflection.FieldInfo" /> object representing the field that is identified by the specified metadata token.
Returns the field identified by the specified metadata token.
public FieldInfo
ResolveField​(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
metadataToken A metadata token that identifies a field in the module.
genericTypeArguments An array of <see cref="T:System.Type" /> objects representing the generic type arguments of the type where the token is in scope, or <see langword="null" /> if that type is not generic.
genericMethodArguments An array of <see cref="T:System.Type" /> objects representing the generic type arguments of the method where the token is in scope, or <see langword="null" /> if that method is not generic.
Returns A <see cref="T:System.Reflection.FieldInfo" /> object representing the field that is identified by the specified metadata token.
Returns the field identified by the specified metadata token, in the context defined by the specified generic type parameters.
public MemberInfo
ResolveMember​(int metadataToken)
metadataToken A metadata token that identifies a type or member in the module.
Returns A <see cref="T:System.Reflection.MemberInfo" /> object representing the type or member that is identified by the specified metadata token.
Returns the type or member identified by the specified metadata token.
public MemberInfo
ResolveMember​(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
metadataToken A metadata token that identifies a type or member in the module.
genericTypeArguments An array of <see cref="T:System.Type" /> objects representing the generic type arguments of the type where the token is in scope, or <see langword="null" /> if that type is not generic.
genericMethodArguments An array of <see cref="T:System.Type" /> objects representing the generic type arguments of the method where the token is in scope, or <see langword="null" /> if that method is not generic.
Returns A <see cref="T:System.Reflection.MemberInfo" /> object representing the type or member that is identified by the specified metadata token.
Returns the type or member identified by the specified metadata token, in the context defined by the specified generic type parameters.
public MethodBase
ResolveMethod​(int metadataToken)
metadataToken A metadata token that identifies a method or constructor in the module.
Returns A <see cref="T:System.Reflection.MethodBase" /> object representing the method or constructor that is identified by the specified metadata token.
Returns the method or constructor identified by the specified metadata token.
public MethodBase
ResolveMethod​(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
metadataToken A metadata token that identifies a method or constructor in the module.
genericTypeArguments An array of <see cref="T:System.Type" /> objects representing the generic type arguments of the type where the token is in scope, or <see langword="null" /> if that type is not generic.
genericMethodArguments An array of <see cref="T:System.Type" /> objects representing the generic type arguments of the method where the token is in scope, or <see langword="null" /> if that method is not generic.
Returns A <see cref="T:System.Reflection.MethodBase" /> object representing the method that is identified by the specified metadata token.
Returns the method or constructor identified by the specified metadata token, in the context defined by the specified generic type parameters.
public byte[]
ResolveSignature​(int metadataToken)
metadataToken A metadata token that identifies a signature in the module.
Returns An array of bytes representing the signature blob.
Returns the signature blob identified by a metadata token.
public string
ResolveString​(int metadataToken)
metadataToken A metadata token that identifies a string in the string heap of the module.
Returns A <see cref="T:System.String" /> containing a string value from the metadata string heap.
Returns the string identified by the specified metadata token.
public Type
ResolveType​(int metadataToken)
metadataToken A metadata token that identifies a type in the module.
Returns A <see cref="T:System.Type" /> object representing the type that is identified by the specified metadata token.
Returns the type identified by the specified metadata token.
public Type
ResolveType​(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
metadataToken A metadata token that identifies a type in the module.
genericTypeArguments An array of <see cref="T:System.Type" /> objects representing the generic type arguments of the type where the token is in scope, or <see langword="null" /> if that type is not generic.
genericMethodArguments An array of <see cref="T:System.Type" /> objects representing the generic type arguments of the method where the token is in scope, or <see langword="null" /> if that method is not generic.
Returns A <see cref="T:System.Type" /> object representing the type that is identified by the specified metadata token.
Returns the type identified by the specified metadata token, in the context defined by the specified generic type parameters.
public string
ToString​()
Returns A <see langword="String" /> representing the name of this module.
Returns the name of the module.
protected void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public Type
GetType​()
Inherited from object
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates a shallow copy of the current <see cref="T:System.Object" /> .