Type.Module Type.Module Type.Module Type.Module Property

Definition

Ruft das Modul (die DLL) ab, in dem der aktuelle Type definiert ist.Gets the module (the DLL) in which the current Type is defined.

public:
 abstract property System::Reflection::Module ^ Module { System::Reflection::Module ^ get(); };
public abstract System.Reflection.Module Module { get; }
member this.Module : System.Reflection.Module
Public MustOverride ReadOnly Property Module As Module

Eigenschaftswert

Das Modul, in dem der aktuelle Type definiert ist.The module in which the current Type is defined.

Implementiert

Beispiele

Im folgenden Namespace Beispiel wird die Verwendung der-Eigenschaft und Module der-Eigenschaft und Typeder ToString -Methode von veranschaulicht.This following example demonstrates a use of the Namespace and Module properties and the ToString method of Type.

using namespace System;

namespace MyNamespace
{
   ref class MyClass
   {
   };
}

void main()
{
      Type^ myType = MyNamespace::MyClass::typeid;
      Console::WriteLine("Displaying information about {0}:", myType );
      
      // Get the namespace of the class MyClass.
      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 );
}
// The example displays the following output:
//    Displaying information about MyNamespace.MyClass:
//       Namespace: MyNamespace
//       Module: type_tostring.exe
//       Fully qualified name: MyNamespace.MyClass
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.
Namespace MyNamespace
    Class [MyClass]
    End Class 
End Namespace 

Public Class Example
    Public Shared Sub Main()
         Dim myType As Type = GetType(MyNamespace.MyClass)
         Console.WriteLine(", 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())
    End Sub
End Class
' The example displays the following output:
'       Displaying information about MyNamespace.MyClass:
'          Namespace: MyNamespace.
'          Module: type_tostring.exe.
'          Fully qualified name: MyNamespace.MyClass.

Hinweise

Wenn der aktuelle Type einen konstruierten generischen Typ darstellt, gibt diese Eigenschaft das Modul zurück, in dem die generische Typdefinition definiert wurde.If the current Type represents a constructed generic type, this property returns the module in which the generic type definition was defined. Wenn Sie z. b. eine Instanz von MyGenericStack<int>erstellen, Module MyGenericStack<T> gibt die-Eigenschaft für den konstruierten Typ das Modul zurück, in dem definiert ist.For example, if you create an instance of MyGenericStack<int>, the Module property for the constructed type returns the module in which MyGenericStack<T> is defined.

Wenn der aktuelle Type einen generischen Parameter Tdarstellt, gibt diese Eigenschaft die Assembly zurück, die den generischen Typ enthält T, der definiert.Similarly, if the current Type represents a generic parameter T, this property returns the assembly that contains the generic type that defines T.

Gilt für:

Siehe auch