Assembly.GetModules Metoda

Definicja

Pobiera wszystkie moduły, które są częścią tego zestawu.

Przeciążenia

GetModules()

Pobiera wszystkie moduły, które są częścią tego zestawu.

GetModules(Boolean)

Pobiera wszystkie moduły, które są częścią tego zestawu, określając, czy mają być uwzględniane moduły zasobów.

GetModules()

Pobiera wszystkie moduły, które są częścią tego zestawu.

public:
 cli::array <System::Reflection::Module ^> ^ GetModules();
public:
 virtual cli::array <System::Reflection::Module ^> ^ GetModules();
public System.Reflection.Module[] GetModules ();
member this.GetModules : unit -> System.Reflection.Module[]
abstract member GetModules : unit -> System.Reflection.Module[]
override this.GetModules : unit -> System.Reflection.Module[]
Public Function GetModules () As Module()

Zwraca

Module[]

Tablica modułów.

Implementuje

Wyjątki

Ładowany moduł nie określa rozszerzenia nazwy pliku.

Przykłady

Poniższy przykład przedstawia nazwę modułu w zwróconej tablicy zawierającej manifest zestawu.

using namespace System;
using namespace System::Reflection;
int main()
{
   Assembly^ mainAssembly = Assembly::GetExecutingAssembly();
   Console::WriteLine( "The executing assembly is {0}.", mainAssembly );
   array<Module^>^mods = mainAssembly->GetModules();
   Console::WriteLine( "\tModules in the assembly:" );
   for ( int i = 0; i < mods->Length; i++ )
      Console::WriteLine( "\t{0}", mods[ i ] );
}
using System;
using System.Reflection;

public class Example
{
    public static void Main()
    {
        Assembly mainAssembly = typeof(Example).Assembly;
        Console.WriteLine("The executing assembly is {0}.", mainAssembly);
        Module[] mods = mainAssembly.GetModules();
        Console.WriteLine("\tModules in the assembly:");
        foreach (Module m in mods)
            Console.WriteLine("\t{0}", m);
    }
}
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

Uwagi

Ta metoda działa na plikach zasobów publicznych i prywatnych.

Uwaga

Moduły muszą być emitowane z rozszerzeniami nazw plików.

Dotyczy

GetModules(Boolean)

Pobiera wszystkie moduły, które są częścią tego zestawu, określając, czy mają być uwzględniane moduły zasobów.

public:
 virtual cli::array <System::Reflection::Module ^> ^ GetModules(bool getResourceModules);
public virtual System.Reflection.Module[] GetModules (bool getResourceModules);
public System.Reflection.Module[] GetModules (bool getResourceModules);
abstract member GetModules : bool -> System.Reflection.Module[]
override this.GetModules : bool -> System.Reflection.Module[]
Public Overridable Function GetModules (getResourceModules As Boolean) As Module()
Public Function GetModules (getResourceModules As Boolean) As Module()

Parametry

getResourceModules
Boolean

true dołączanie modułów zasobów; w przeciwnym razie , false.

Zwraca

Module[]

Tablica modułów.

Implementuje

Uwagi

Ta metoda działa na plikach zasobów publicznych i prywatnych.

Uwaga

Moduły muszą być emitowane z rozszerzeniami nazw plików.

Dotyczy