1 out of 1 rated this helpful - Rate this topic

Module Class

Performs reflection on a module.

System.Object
  System.Reflection.Module
    System.Reflection.Emit.ModuleBuilder

Namespace:  System.Reflection
Assembly:  mscorlib (in mscorlib.dll)
[SerializableAttribute]
[ComVisibleAttribute(true)]
[ClassInterfaceAttribute(ClassInterfaceType.None)]
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Unrestricted = true)]
public abstract class Module : _Module, 
	ISerializable, ICustomAttributeProvider

The Module type exposes the following members.

  Name Description
Protected method Module Initializes a new instance of the Module class.
Top
  Name Description
Public property Supported by the XNA Framework Supported by Portable Class Library Assembly Gets the appropriate Assembly for this instance of Module.
Public property Supported by the XNA Framework FullyQualifiedName Gets a string representing the fully qualified name and path to this module.
Public property MDStreamVersion Gets the metadata stream version.
Public property MetadataToken Gets a token that identifies the module in metadata.
Public property ModuleHandle Gets a handle for the module.
Public property ModuleVersionId Gets a universally unique identifier (UUID) that can be used to distinguish between two versions of a module.
Public property Supported by the XNA Framework Supported by Portable Class Library Name Gets a String representing the name of the module with the path removed.
Public property ScopeName Gets a string representing the name of the module.
Top
  Name Description
Public method Supported by the XNA Framework Supported by Portable Class Library Equals Determines whether this module and the specified object are equal. (Overrides Object.Equals(Object).)

In XNA Framework 3.0, this member is inherited from Object.Equals(Object).


In Portable Class Library Portable Class Library, this member is inherited from Object.Equals(Object).
Protected method Supported by the XNA Framework Supported by Portable Class Library Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method FindTypes Returns an array of classes accepted by the given filter and filter criteria.
Public method Supported by the XNA Framework Supported by Portable Class Library GetCustomAttributes(Boolean) Returns all custom attributes.
Public method Supported by the XNA Framework Supported by Portable Class Library GetCustomAttributes(Type, Boolean) Gets custom attributes of the specified type.
Public method GetCustomAttributesData Returns a list of CustomAttributeData objects for the current module, which can be used in the reflection-only context.
Public method GetField(String) Returns a field having the specified name.
Public method GetField(String, BindingFlags) Returns a field having the specified name and binding attributes.
Public method GetFields() Returns the global fields defined on the module.
Public method GetFields(BindingFlags) Returns the global fields defined on the module that match the specified binding flags.
Public method Supported by the XNA Framework Supported by Portable Class Library GetHashCode Returns the hash code for this instance. (Overrides Object.GetHashCode().)

In XNA Framework 3.0, this member is inherited from Object.GetHashCode().


In Portable Class Library Portable Class Library, this member is inherited from Object.GetHashCode().
Public method GetMethod(String) Returns a method having the specified name.
Public method GetMethod(String, Type[]) Returns a method having the specified name and parameter types.
Public method GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) Returns a method having the specified name, binding information, calling convention, and parameter types and modifiers.
Protected method GetMethodImpl Returns the method implementation in accordance with the specified criteria.
Public method GetMethods() Returns the global methods defined on the module.
Public method GetMethods(BindingFlags) Returns the global methods defined on the module that match the specified binding flags.
Public method GetObjectData Provides an ISerializable implementation for serialized objects.
Public method GetPEKind Gets a pair of values indicating the nature of the code in a module and the platform targeted by the module.
Public method GetSignerCertificate Returns an X509Certificate object corresponding to the certificate included in the Authenticode signature of the assembly which this module belongs to. If the assembly has not been Authenticode signed, null is returned.
Public method Supported by the XNA Framework Supported by Portable Class Library GetType() Gets the Type of the current instance. (Inherited from Object.)
Public method Supported by the XNA Framework Supported by Portable Class Library GetType(String) Returns the specified type, performing a case-sensitive search.
Public method GetType(String, Boolean) Returns the specified type, searching the module with the specified case sensitivity.
Public method GetType(String, Boolean, Boolean) 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 method Supported by the XNA Framework Supported by Portable Class Library GetTypes Returns all the types defined within this module.
Public method Supported by the XNA Framework Supported by Portable Class Library IsDefined Returns a value that indicates whether the specified attribute type has been applied to this module.
Public method IsResource Gets a value indicating whether the object is a resource.
Protected method Supported by the XNA Framework Supported by Portable Class Library MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ResolveField(Int32) Returns the field identified by the specified metadata token.
Public method ResolveField(Int32, Type[], Type[]) Returns the field identified by the specified metadata token, in the context defined by the specified generic type parameters.
Public method ResolveMember(Int32) Returns the type or member identified by the specified metadata token.
Public method ResolveMember(Int32, Type[], Type[]) Returns the type or member identified by the specified metadata token, in the context defined by the specified generic type parameters.
Public method ResolveMethod(Int32) Returns the method or constructor identified by the specified metadata token.
Public method ResolveMethod(Int32, Type[], Type[]) Returns the method or constructor identified by the specified metadata token, in the context defined by the specified generic type parameters.
Public method ResolveSignature Returns the signature blob identified by a metadata token.
Public method ResolveString Returns the string identified by the specified metadata token.
Public method ResolveType(Int32) Returns the type identified by the specified metadata token.
Public method ResolveType(Int32, Type[], Type[]) Returns the type identified by the specified metadata token, in the context defined by the specified generic type parameters.
Public method Supported by the XNA Framework Supported by Portable Class Library ToString Returns the name of the module. (Overrides Object.ToString().)
Top
  Name Description
Public operator Static member Equality Indicates whether two Module objects are equal.
Public operator Static member Inequality Indicates whether two Module objects are not equal.
Top
  Name Description
Public field Static member FilterTypeName A 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 field Static member FilterTypeNameIgnoreCase A TypeFilter object that filters the list of types defined in this module based upon the name. This field is case-insensitive and read-only.
Top
  Name Description
Explicit interface implemetation Private method _Module.GetIDsOfNames Maps a set of names to a corresponding set of dispatch identifiers.
Explicit interface implemetation Private method _Module.GetTypeInfo Retrieves the type information for an object, which can then be used to get the type information for an interface.
Explicit interface implemetation Private method _Module.GetTypeInfoCount Retrieves the number of type information interfaces that an object provides (either 0 or 1).
Explicit interface implemetation Private method _Module.Invoke Provides access to properties and methods exposed by an object.
Top

A module is a portable executable file, such as type.dll or application.exe, consisting of one or more classes and interfaces. There may be multiple namespaces contained in a single module, and a namespace may span multiple modules.

One or more modules deployed as a unit compose an assembly. For information about creating an assembly with more than one module, see Multifile Assemblies.

Note that a .NET Framework module is not the same as a module in Visual Basic, which is used by a programmers to organize functions and subroutines in an application.

The following code examples show how to use reflection to get information about modules:


using System.Reflection;
using System;
public class Program {

    public static void Main() {
        Class1 c1 = new Class1();
        //  Show the current module.
        Module m = c1.GetType().Module;
        Console.WriteLine("The current module is {0}.", m.Name);

        //  List all modules in the assembly.
        Assembly curAssembly = Assembly.GetExecutingAssembly();
        Console.WriteLine("The current executing assembly is {0}.", curAssembly);

        Module[] mods = curAssembly.GetModules();
        foreach (Module md in mods) {
            Console.WriteLine("This assembly contains the {0} module", md.Name);
        }
        Console.ReadLine();
    }
}
class Class1 {
}


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ