Share via


Type.Module プロパティ

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

Public MustOverride ReadOnly Property Module As Module
[C#]
public abstract Module Module {get;}
[C++]
public: __property virtual Module* get_Module() = 0;
[JScript]
public abstract function get Module() : Module;

プロパティ値

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

使用例

[Visual Basic, C#, C++] TypeNamespace プロパティと Module プロパティ、および ToString メソッドを使用する例を次に示します。

 
Imports System
Imports Microsoft.VisualBasic
Namespace MyNamespace
    Class [MyClass]
    End Class '[MyClass]
End Namespace 'MyNamespace
Public Class Type_ToString_3
    Public Shared Sub Main()
        Try
            Dim myType As Type = GetType(MyNamespace.MyClass)
            Console.WriteLine(ControlChars.NewLine + "Printing the details of {0}." + ControlChars.NewLine, myType)
            ' Get the namespace of the class Type_ToString_3.
            Console.WriteLine("Namespace: {0}.", myType.Namespace)
            ' Get the name of the module.
            Console.WriteLine("Module: {0}.", myType.Module)
            ' Get the fully qualified common language runtime namespace.
            Console.WriteLine("Fully qualified type: {0}.", myType.ToString())
        Catch e As Exception
            Console.WriteLine("Exception: " + e.Message.ToString())
        End Try
    End Sub 'Main
End Class 'Type_ToString_3

[C#] 
using System;
namespace MyNamespace
{
    class MyClass
    {
    }
}
public class Type_ToString_3
{
    public static void Main()
    {
        try
        {
            Type myType = typeof(MyNamespace.MyClass);
            Console.WriteLine("\nPrinting the details of {0}.\n", myType); 
            // Get the namespace of the class Type_ToString_3.
            Console.WriteLine("Namespace: {0}.", myType.Namespace);
            // Get the name of the module.
            Console.WriteLine("Module: {0}.", myType.Module);
            // Get the fully qualified common language runtime namespace.
            Console.WriteLine("Fully qualified type: {0}.", myType.ToString());
        }
        catch(Exception e)
        {
            Console.WriteLine("Exception: " + e.Message ); 
        }
    }
}

[C++] 
#using <mscorlib.dll>

using namespace System;

namespace MyNamespace {
   __gc class MyClass {
   };
}

int main() {
   try {
      Type*  myType = __typeof(MyNamespace::MyClass);
      Console::WriteLine(S"\nPrinting the details of {0}.\n", myType);
      // Get the namespace of the class MyClass.
      Console::WriteLine(S"Namespace: {0}.", myType->Namespace);
      // Get the name of the module.
      Console::WriteLine(S"Module: {0}.", myType->Module);
      // Get the fully qualified common language runtime namespace.
      Console::WriteLine(S"Fully qualified type: {0}.", myType);
   } catch (Exception* e) {
      Console::WriteLine(S"Exception: {0}", e->Message);
   }
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET, Common Language Infrastructure (CLI) Standard

参照

Type クラス | Type メンバ | System 名前空間 | Module