英語で読む 編集

次の方法で共有


Assembly.GetModules Method

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Gets all the modules that are part of this assembly.

Overloads

GetModules()

Gets all the modules that are part of this assembly.

GetModules(Boolean)

Gets all the modules that are part of this assembly, specifying whether to include resource modules.

GetModules()

Source:
Assembly.cs
Source:
Assembly.cs
Source:
Assembly.cs

Gets all the modules that are part of this assembly.

C#
public System.Reflection.Module[] GetModules();

Returns

Module[]

An array of modules.

Implements

Exceptions

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

Examples

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

C#
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);
    }
}

Remarks

This method works on public and private resource files.

注意

Modules must be emitted with file name extensions.

Applies to

.NET 10 およびその他のバージョン
製品 バージョン
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

GetModules(Boolean)

Source:
Assembly.cs
Source:
Assembly.cs
Source:
Assembly.cs

Gets all the modules that are part of this assembly, specifying whether to include resource modules.

C#
public virtual System.Reflection.Module[] GetModules(bool getResourceModules);
C#
public System.Reflection.Module[] GetModules(bool getResourceModules);

Parameters

getResourceModules
Boolean

true to include resource modules; otherwise, false.

Returns

Module[]

An array of modules.

Implements

Remarks

This method works on public and private resource files.

注意

Modules must be emitted with file name extensions.

Applies to

.NET 10 およびその他のバージョン
製品 バージョン
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1