Module クラス

定義

モジュールに対してリフレクションを実行します。

public ref class Module abstract
public ref class Module abstract : System::Reflection::ICustomAttributeProvider, System::Runtime::Serialization::ISerializable
public ref class Module abstract : System::Reflection::ICustomAttributeProvider
public ref class Module : System::Reflection::ICustomAttributeProvider, System::Runtime::InteropServices::_Module, System::Runtime::Serialization::ISerializable
public ref class Module abstract : System::Reflection::ICustomAttributeProvider, System::Runtime::InteropServices::_Module, System::Runtime::Serialization::ISerializable
public abstract class Module
public abstract class Module : System.Reflection.ICustomAttributeProvider, System.Runtime.Serialization.ISerializable
public abstract class Module : System.Reflection.ICustomAttributeProvider
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Serializable]
public class Module : System.Reflection.ICustomAttributeProvider, System.Runtime.InteropServices._Module, System.Runtime.Serialization.ISerializable
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public class Module : System.Reflection.ICustomAttributeProvider, System.Runtime.InteropServices._Module, System.Runtime.Serialization.ISerializable
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class Module : System.Reflection.ICustomAttributeProvider, System.Runtime.InteropServices._Module, System.Runtime.Serialization.ISerializable
type Module = class
type Module = class
    interface ICustomAttributeProvider
    interface ISerializable
type Module = class
    interface ICustomAttributeProvider
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)>]
[<System.Serializable>]
type Module = class
    interface _Module
    interface ISerializable
    interface ICustomAttributeProvider
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)>]
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type Module = class
    interface _Module
    interface ISerializable
    interface ICustomAttributeProvider
Public MustInherit Class Module
Public MustInherit Class Module
Implements ICustomAttributeProvider, ISerializable
Public MustInherit Class Module
Implements ICustomAttributeProvider
Public Class Module
Implements _Module, ICustomAttributeProvider, ISerializable
Public MustInherit Class Module
Implements _Module, ICustomAttributeProvider, ISerializable
継承
Module
派生
属性
実装

次のコード例は、リフレクションを使用してモジュールに関する情報を取得する方法を示しています。

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 = typeof(Program).Assembly;
        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 {
}
Imports System.Reflection

Public Class Program
    Public Shared Sub Main()

        Dim c1 As New Class1

        ' Show the current module.

        ' Note the brackets around "[Module]" to differentiate 
        ' it from the Visual Basic "Module" keyword.
        Dim m As [Module] = c1.GetType().Module
        Console.WriteLine("The current module is {0}.", m.Name)

        ' List all modules in the assembly.
        Dim curAssembly As Assembly = GetType(Program).Assembly
        Console.WriteLine("The executing assembly is {0}.", curAssembly)

        Dim mods() As [Module] = curAssembly.GetModules()

        For Each md As [Module] In mods
            Console.WriteLine("This assembly contains the {0} module", md.Name)
        Next
        Console.ReadLine()
    End Sub


End Class
Class Class1

End Class

注釈

モジュールは、1 つ以上のクラスとインターフェイスで構成される、type.dll や application.exeなどの移植可能な実行可能ファイルです。 1 つのモジュールに複数の名前空間が含まれている場合があり、1 つの名前空間が複数のモジュールにまたがる場合があります。

1 つのユニットとしてデプロイされた 1 つ以上のモジュールがアセンブリを構成します。 複数のモジュールを含むアセンブリの作成については、「 マルチファイル アセンブリ」を参照してください。

.NET Framework モジュールは、プログラマがアプリケーション内の関数やサブルーチンを整理するために使用するVisual Basicのモジュールと同じではないことに注意してください。

コンストラクター

名前 説明
Module()

Module クラスの新しいインスタンスを初期化します。

フィールド

名前 説明
FilterTypeName

名前に基づいてこのモジュールで定義されている型の一覧をフィルター処理する TypeFilter オブジェクト。 このフィールドでは、大文字と小文字が区別され、読み取り専用です。

FilterTypeNameIgnoreCase

名前に基づいてこのモジュールで定義されている型の一覧をフィルター処理する TypeFilter オブジェクト。 このフィールドでは大文字と小文字が区別されず、読み取り専用です。

プロパティ

名前 説明
Assembly

Assemblyのこのインスタンスに適したModuleを取得します。

CustomAttributes

このモジュールのカスタム属性を含むコレクションを取得します。

FullyQualifiedName

このモジュールの完全修飾名とパスを表す文字列を取得します。

MDStreamVersion

メタデータ ストリームのバージョンを取得します。

MetadataToken

メタデータ内のモジュールを識別するトークンを取得します。

ModuleHandle

モジュールのハンドルを取得します。

ModuleVersionId

モジュールの 2 つのバージョンを区別するために使用できる汎用一意識別子 (UUID) を取得します。

Name

パスが削除されたモジュールの名前を表す String を取得します。

ScopeName

モジュールの名前を表す文字列を取得します。

メソッド

名前 説明
Equals(Object)

このモジュールと指定したオブジェクトが等しいかどうかを判断します。

Equals(Object)

指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
FindTypes(TypeFilter, Object)

指定されたフィルター条件とフィルター条件で受け入れられるクラスの配列を返します。

GetCustomAttributes(Boolean)

すべてのカスタム属性を返します。

GetCustomAttributes(Type, Boolean)

指定した型のカスタム属性を取得します。

GetCustomAttributesData()

リフレクションのみのコンテキストで使用できる、現在のモジュールの CustomAttributeData オブジェクトの一覧を返します。

GetField(String, BindingFlags)

指定した名前とバインド属性を持つフィールドを返します。

GetField(String)

指定した名前のフィールドを返します。

GetFields()

モジュールで定義されているグローバル フィールドを返します。

GetFields(BindingFlags)

指定したバインド フラグに一致するモジュールで定義されているグローバル フィールドを返します。

GetHashCode()

このインスタンスのハッシュ コードを返します。

GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

指定した名前、バインディング情報、呼び出し規則、およびパラメーターの型と修飾子を持つメソッドを返します。

GetMethod(String, Type[])

指定した名前とパラメーター型を持つメソッドを返します。

GetMethod(String)

指定した名前のメソッドを返します。

GetMethodImpl(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

指定した条件に従ってメソッドの実装を返します。

GetMethods()

モジュールで定義されているグローバル メソッドを返します。

GetMethods(BindingFlags)

指定したバインド フラグに一致するモジュールで定義されているグローバル メソッドを返します。

GetObjectData(SerializationInfo, StreamingContext)
古い.

シリアル化されたオブジェクトの ISerializable 実装を提供します。

GetPEKind(PortableExecutableKinds, ImageFileMachine)

モジュール内のコードの性質と、モジュールの対象となるプラットフォームを示す値のペアを取得します。

GetSignerCertificate()

このモジュールが属するアセンブリの Authenticode 署名に含まれる証明書に対応する X509Certificate オブジェクトを返します。 アセンブリが Authenticode 署名されていない場合は、 null が返されます。

GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
GetType(String, Boolean, Boolean)

モジュールの大文字と小文字を区別する検索を行うかどうか、および型が見つからない場合に例外をスローするかどうかを指定して、指定した型を返します。

GetType(String, Boolean)

指定した型を返し、指定した大文字と小文字を区別してモジュールを検索します。

GetType(String)

大文字と小文字を区別する検索を実行して、指定した型を返します。

GetTypes()

このモジュール内で定義されているすべての型を返します。

IsDefined(Type, Boolean)

指定した属性型がこのモジュールに適用されているかどうかを示す値を返します。

IsResource()

オブジェクトがリソースであるかどうかを示す値を取得します。

MemberwiseClone()

現在の Objectの簡易コピーを作成します。

(継承元 Object)
ResolveField(Int32, Type[], Type[])

指定したジェネリック型パラメーターによって定義されたコンテキストで、指定したメタデータ トークンによって識別されるフィールドを返します。

ResolveField(Int32)

指定したメタデータ トークンによって識別されるフィールドを返します。

ResolveMember(Int32, Type[], Type[])

指定したジェネリック型パラメーターによって定義されたコンテキストで、指定したメタデータ トークンによって識別される型またはメンバーを返します。

ResolveMember(Int32)

指定したメタデータ トークンによって識別される型またはメンバーを返します。

ResolveMethod(Int32, Type[], Type[])

指定したジェネリック型パラメーターによって定義されたコンテキストで、指定したメタデータ トークンによって識別されるメソッドまたはコンストラクターを返します。

ResolveMethod(Int32)

指定したメタデータ トークンによって識別されるメソッドまたはコンストラクターを返します。

ResolveSignature(Int32)

メタデータ トークンによって識別される署名 BLOB を返します。

ResolveString(Int32)

指定したメタデータ トークンによって識別される文字列を返します。

ResolveType(Int32, Type[], Type[])

指定したジェネリック型パラメーターによって定義されたコンテキストで、指定したメタデータ トークンによって識別される型を返します。

ResolveType(Int32)

指定したメタデータ トークンによって識別される型を返します。

ToString()

モジュールの名前を返します。

演算子

名前 説明
Equality(Module, Module)

2 つの Module オブジェクトが等しいかどうかを示します。

Inequality(Module, Module)

2 つの Module オブジェクトが等しくないかどうかを示します。

明示的なインターフェイスの実装

名前 説明
_Module.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

一連の名前を対応する一連のディスパッチ識別子に割り当てます。

_Module.GetTypeInfo(UInt32, UInt32, IntPtr)

オブジェクトの型情報を取得します。この型情報を使用して、インターフェイスの型情報を取得できます。

_Module.GetTypeInfoCount(UInt32)

オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。

_Module.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

オブジェクトによって公開されるプロパティとメソッドへのアクセスを提供します。

ICustomAttributeProvider.GetCustomAttributes(Boolean)

名前付き属性を除き、このメンバーで定義されているすべてのカスタム属性の配列を返します。カスタム属性がない場合は空の配列を返します。

ICustomAttributeProvider.GetCustomAttributes(Type, Boolean)

このメンバーで定義されているカスタム属性の配列を型で識別するか、その型のカスタム属性がない場合は空の配列を返します。

ICustomAttributeProvider.IsDefined(Type, Boolean)

attributeTypeの 1 つ以上のインスタンスがこのメンバーで定義されているかどうかを示します。

拡張メソッド

名前 説明
GetCustomAttribute(Module, Type)

指定したモジュールに適用される、指定した型のカスタム属性を取得します。

GetCustomAttribute<T>(Module)

指定したモジュールに適用される、指定した型のカスタム属性を取得します。

GetCustomAttributes(Module, Type)

指定したモジュールに適用される、指定した型のカスタム属性のコレクションを取得します。

GetCustomAttributes(Module)

指定したモジュールに適用されるカスタム属性のコレクションを取得します。

GetCustomAttributes<T>(Module)

指定したモジュールに適用される、指定した型のカスタム属性のコレクションを取得します。

GetModuleVersionId(Module)

モジュールに対してリフレクションを実行します。

HasModuleVersionId(Module)

モジュールに対してリフレクションを実行します。

IsDefined(Module, Type)

指定した型のカスタム属性が指定したモジュールに適用されるかどうかを示します。

適用対象