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