Assembly Propiedad
TOC
Collapse the table of content
Expand the table of content
Este artículo se tradujo automáticamente. Para ver el artículo en inglés, active la casilla Inglés. Además, puede mostrar el texto en inglés en una ventana emergente si mueve el puntero del mouse sobre el texto.
Traducción
Inglés

Type.Assembly (Propiedad)

 

Gets the Assembly in which the type is declared. For generic types, gets the Assembly in which the generic type is defined.

Espacio de nombres:   System
Ensamblado:  mscorlib (en mscorlib.dll)

public abstract Assembly Assembly { get; }

Valor de propiedad

Type: System.Reflection.Assembly

An Assembly instance that describes the assembly containing the current type. For generic types, the instance describes the assembly that contains the generic type definition, not the assembly that creates and uses a particular constructed type.

Implementaciones

_Type.Assembly

If the current T:System.Type object represents a constructed generic type, this property returns the assembly that contains the generic type definition. For example, suppose you create an assembly named MyGenerics.dll that contains the generic type definition MyGenericStack<T> (MyGenericStack(Of T) in Visual Basic, generic<T> ref class MyGenericStack in C++). If you create an instance of MyGenericStack<int> (MyGenericStack(Of Integer) in Visual Basic) in another assembly, the P:System.Type.Assembly property for the constructed type returns an T:System.Reflection.Assembly object that represents MyGenerics.dll.

Similarly, if the current T:System.Type object represents an unassigned generic parameter T, this property returns the assembly that contains the generic type that defines T.

This property is read-only.

The following example displays the assembly name associated with the class and the fully qualified name of the type.

using System;
using System.Reflection;

class MyAssemblyClass
{
    public static void Main()
    {
        Type objType = typeof(System.Array);

        // Print the full assembly name.
        Console.WriteLine ("Full assembly name:\n   {0}.", 
                           objType.Assembly.FullName.ToString()); 

        // Print the qualified assembly name.
        Console.WriteLine ("Qualified assembly name:\n   {0}.", 
                           objType.AssemblyQualifiedName.ToString()); 
    }
}
// The example displays the following output if run under the .NET Framework 4.5:
//    Full assembly name:
//       mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
//    Qualified assembly name:
//       System.Array, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.

.NET Framework
Disponible desde 1.1
Portable Class Library
Compatible con: portable .NET platforms
Silverlight
Disponible desde 2.0
Windows Phone Silverlight
Disponible desde 7.0
Volver al principio
Mostrar:
© 2016 Microsoft