Leggi in inglese

Condividi tramite


Type.Module Proprietà

Definizione

Ottiene il modulo (DLL) in cui è definito l'oggetto Type corrente.

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

Valore della proprietà

Modulo in cui è definito l'oggetto Type corrente.

Implementazioni

Esempio

Nell'esempio seguente viene illustrato l'uso delle Namespace proprietà e Module e del ToString metodo di 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.

Commenti

Se l'oggetto corrente Type rappresenta un tipo generico costruito, questa proprietà restituisce il modulo in cui è stata definita la definizione del tipo generico. Ad esempio, se si crea un'istanza di MyGenericStack<int>, la Module proprietà per il tipo costruito restituisce il modulo in cui MyGenericStack<T> è definito.

Analogamente, se l'oggetto corrente Type rappresenta un parametro generico T, questa proprietà restituisce l'assembly che contiene il tipo generico che definisce T.

Si applica a

Prodotto Versioni
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.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, 4.8.1
.NET Standard 2.0, 2.1

Vedi anche