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
[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.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
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)>]
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type Module = class
    interface ISerializable
    interface ICustomAttributeProvider
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)>]
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type Module = class
    interface ISerializable
    interface ICustomAttributeProvider
    interface _Module
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 つ以上のモジュールによってアセンブリが構成されます。 複数のモジュールを使用してアセンブリを作成する方法については、「 マルチファイル アセンブリ」を参照してください。

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

コンストラクター

Module()

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

フィールド

FilterTypeName

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

FilterTypeNameIgnoreCase

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

プロパティ

Assembly

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

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)

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

GetField(String, BindingFlags)

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

GetFields()

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

GetFields(BindingFlags)

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

GetHashCode()

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

GetHashCode()

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

(継承元 Object)
GetMethod(String)

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

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

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

GetMethod(String, Type[])

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

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)

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

GetType(String, Boolean)

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

GetType(String, Boolean, Boolean)

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

GetTypes()

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

IsDefined(Type, Boolean)

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

IsResource()

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

MemberwiseClone()

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

(継承元 Object)
ResolveField(Int32)

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

ResolveField(Int32, Type[], Type[])

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

ResolveMember(Int32)

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

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

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

ResolveMethod(Int32)

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

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

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

ResolveSignature(Int32)

メタデータ トークンで識別されるシグネチャ BLOB を返します。

ResolveString(Int32)

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

ResolveType(Int32)

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

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

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

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)

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

GetCustomAttributes(Module, Type)

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

GetCustomAttributes<T>(Module)

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

IsDefined(Module, Type)

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

GetModuleVersionId(Module)

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

HasModuleVersionId(Module)

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

適用対象