Assembly.GetModules Method ()

 

Gets all the modules that are part of this assembly.

Namespace:   System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

Public Function GetModules As Module()

Return Value

Type: System.Reflection.Module()

An array of modules.

Exception Condition
FileNotFoundException

The module to be loaded does not specify a file name extension.

This method works on public and private resource files.

System_CAPS_noteNote

Modules must be emitted with file name extensions.

The following example displays the name of the module in the returned array that contains the assembly manifest.

Imports System.Reflection

Public Class Example
    Public Shared Sub Main()
        Dim mainAssembly As Assembly = GetType(Example).Assembly
        Console.WriteLine("The executing assembly is {0}.", mainAssembly)
        Dim mods() As [Module] = mainAssembly.GetModules()
        Console.WriteLine(vbTab & "Modules in the assembly:")
        For Each m As [Module] In mods
            Console.WriteLine(vbTab & m.ToString())
        Next
    End Sub 
End Class 

.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show: