MSDN

.NET API Reference

Namespace

System.Reflection

Class Module

Represents an executable module, such as a DLL or EXE, in an assembly.

Syntax

public abstract class Module : System.Object

Inheritance

Object → Module

Constructors

The Module class is abstract; you cannot instantiate it directly.

Properties

NameTypeDescription
NameStringGets the name of the module.
FullyQualifiedNameStringGets the full path or UNC location of the module.
MetadataTokenInt32Gets a token that identifies the current module in the metadata.
AssemblyAssemblyGets the assembly that contains this module.

Methods

GetTypes

Retrieves all the types defined in this module.

public Type[] GetTypes()

FindTypes

Searches for the types that match the specified filter criteria.

public Type[] FindTypes(TypeFilter filter, Object filterCriteria)

GetCustomAttributes

Returns an array of custom attributes applied to this module.

public Object[] GetCustomAttributes(bool inherit)

Examples

using System;
using System.Reflection;

class Demo
{
    static void Main()
    {
        Assembly asm = Assembly.GetExecutingAssembly();
        Module mod = asm.GetModules()[0];

        Console.WriteLine($"Module Name: {mod.Name}");
        Console.WriteLine($"Full Name: {mod.FullyQualifiedName}");
        Console.WriteLine("Types in module:");
        foreach (var t in mod.GetTypes())
        {
            Console.WriteLine($" - {t.FullName}");
        }
    }
}

See Also