英語で読む

次の方法で共有


Type.Module プロパティ

定義

現在の Type が定義されているモジュール (DLL) を取得します。

C#
public abstract System.Reflection.Module Module { get; }

プロパティ値

Module

現在の Type が定義されているモジュールです。

実装

次の例では、 プロパティと プロパティ、および の Namespace Module メソッドの使用 ToString を示します Type

C#
using System;

namespace MyNamespace
{
    class MyClass
    {
    }
}

public class Example
{
    public static void Main()
    {
         Type myType = typeof(MyNamespace.MyClass);
         Console.WriteLine("Displaying information about {0}:", myType);
         // Get the namespace of the myClass class.
         Console.WriteLine("   Namespace: {0}.", myType.Namespace);
         // Get the name of the module.
         Console.WriteLine("   Module: {0}.", myType.Module);
         // Get the fully qualified type name.
         Console.WriteLine("   Fully qualified name: {0}.", myType.ToString());
    }
}
// The example displays the following output:
//    Displaying information about MyNamespace.MyClass:
//       Namespace: MyNamespace.
//       Module: type_tostring.exe.
//       Fully qualified name: MyNamespace.MyClass.

注釈

現在の が構築されたジェネリック型を表す場合、このプロパティはジェネリック型定義が定義された Type モジュールを返します。 たとえば、 のインスタンスを作成した場合、構築された型の プロパティは、 が定義されている MyGenericStack<int> Module モジュールを MyGenericStack<T> 返します。

同様に、現在の がジェネリック パラメーター を表している場合、このプロパティは を定義するジェネリック型を含 Type T むアセンブリを返します T

適用対象

製品 バージョン
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7
.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
.NET Standard 2.0, 2.1

こちらもご覧ください