.NET Framework Class Library Assembly Class Represents an assembly, which is a reusable, versionable, and self-describing building block of a common language runtime application.

Inheritance Hierarchy
Namespace:
System.Reflection
Assembly:
mscorlib (in mscorlib.dll)

Syntax
<SerializableAttribute> _
<ComVisibleAttribute(True)> _
<ClassInterfaceAttribute(ClassInterfaceType.None)> _
<PermissionSetAttribute(SecurityAction.InheritanceDemand, Unrestricted := True)> _
Public MustInherit Class Assembly _
Implements _Assembly, IEvidenceFactory, ICustomAttributeProvider, ISerializable
[SerializableAttribute]
[ComVisibleAttribute(true)]
[ClassInterfaceAttribute(ClassInterfaceType.None)]
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Unrestricted = true)]
public abstract class Assembly : _Assembly,
IEvidenceFactory, ICustomAttributeProvider, ISerializable
[SerializableAttribute]
[ComVisibleAttribute(true)]
[ClassInterfaceAttribute(ClassInterfaceType::None)]
[PermissionSetAttribute(SecurityAction::InheritanceDemand, Unrestricted = true)]
public ref class Assembly abstract : _Assembly,
IEvidenceFactory, ICustomAttributeProvider, ISerializable
[<AbstractClass>]
[<SerializableAttribute>]
[<ComVisibleAttribute(true)>]
[<ClassInterfaceAttribute(ClassInterfaceType.None)>]
[<PermissionSetAttribute(SecurityAction.InheritanceDemand, Unrestricted = true)>]
type Assembly =
class
interface _Assembly
interface IEvidenceFactory
interface ICustomAttributeProvider
interface ISerializable
end
The Assembly type exposes the following members.

Constructors
|
| Name | Description |
|---|
.gif) | Assembly | Initializes a new instance of the Assembly class. | Top

Methods
|
| Name | Description |
|---|
.gif) .gif) | CreateInstance(String) | Locates the specified type from this assembly and creates an instance of it using the system activator, using case-sensitive search. | .gif) | CreateInstance(String, Boolean) | Locates the specified type from this assembly and creates an instance of it using the system activator, with optional case-sensitive search. | .gif) | CreateInstance(String, Boolean, BindingFlags, Binder, array<Object>[]()[], CultureInfo, array<Object>[]()[]) | Locates the specified type from this assembly and creates an instance of it using the system activator, with optional case-sensitive search and having the specified culture, arguments, and binding and activation attributes. | .gif) .gif) | CreateQualifiedName | Creates the name of a type qualified by the display name of its assembly. | .gif) .gif) .gif) | Equals | Determines whether this assembly and the specified object are equal. (Overrides Object..::.Equals(Object).)
In XNA Framework 3.0, this member is inherited from Object..::.Equals(Object).
In Portable Class Library Portable Class Library, this member is inherited from Object..::.Equals(Object). | .gif) .gif) .gif) | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | .gif) .gif) | GetAssembly | Gets the currently loaded assembly in which the specified class is defined. | .gif) .gif) .gif) .gif) | GetCallingAssembly | Returns the Assembly of the method that invoked the currently executing method. | .gif) .gif) .gif) | GetCustomAttributes(Boolean) | Gets all the custom attributes for this assembly. | .gif) .gif) .gif) | GetCustomAttributes(Type, Boolean) | Gets the custom attributes for this assembly as specified by type. | .gif) | GetCustomAttributesData | Returns information about the attributes that have been applied to the current Assembly, expressed as CustomAttributeData objects. | .gif) .gif) | GetEntryAssembly | Gets the process executable in the default application domain. In other application domains, this is the first executable that was executed by AppDomain..::.ExecuteAssembly. | .gif) .gif) .gif) .gif) | GetExecutingAssembly | Gets the assembly that contains the code that is currently executing. | .gif) | GetExportedTypes | Gets the public types defined in this assembly that are visible outside the assembly. | .gif) | GetFile | Gets a FileStream for the specified file in the file table of the manifest of this assembly. | .gif) | GetFiles()()() | Gets the files in the file table of an assembly manifest. | .gif) | GetFiles(Boolean) | Gets the files in the file table of an assembly manifest, specifying whether to include resource modules. | .gif) .gif) .gif) | GetHashCode | Returns the hash code for this instance. (Overrides Object..::.GetHashCode()()().)
In XNA Framework 3.0, this member is inherited from Object..::.GetHashCode()()().
In Portable Class Library Portable Class Library, this member is inherited from Object..::.GetHashCode()()(). | .gif) | GetLoadedModules()()() | Gets all the loaded modules that are part of this assembly. | .gif) | GetLoadedModules(Boolean) | Gets all the loaded modules that are part of this assembly, specifying whether to include resource modules. | .gif) | GetManifestResourceInfo | Returns information about how the given resource has been persisted. | .gif) .gif) .gif) | GetManifestResourceNames | Returns the names of all the resources in this assembly. | .gif) .gif) .gif) | GetManifestResourceStream(String) | Loads the specified manifest resource from this assembly. | .gif) .gif) .gif) | GetManifestResourceStream(Type, String) | Loads the specified manifest resource, scoped by the namespace of the specified type, from this assembly. | .gif) | GetModule | Gets the specified module in this assembly. | .gif) .gif) .gif) | GetModules()()() | Gets all the modules that are part of this assembly. | .gif) | GetModules(Boolean) | Gets all the modules that are part of this assembly, specifying whether to include resource modules. | .gif) .gif) | GetName()()() | Gets an AssemblyName for this assembly. | .gif) .gif) | GetName(Boolean) | Gets an AssemblyName for this assembly, setting the codebase as specified by copiedName. | .gif) | GetObjectData | Gets serialization information with all of the data needed to reinstantiate this assembly. | .gif) | GetReferencedAssemblies | Gets the AssemblyName objects for all the assemblies referenced by this assembly. | .gif) .gif) .gif) | GetSatelliteAssembly(CultureInfo) | Gets the satellite assembly for the specified culture. | .gif) .gif) .gif) | GetSatelliteAssembly(CultureInfo, Version) | Gets the specified version of the satellite assembly for the specified culture. | .gif) .gif) .gif) | GetType()()() | Gets the Type of the current instance. (Inherited from Object.) | .gif) .gif) .gif) | GetType(String) | Gets the Type object with the specified name in the assembly instance. | .gif) .gif) .gif) | GetType(String, Boolean) | Gets the Type object with the specified name in the assembly instance and optionally throws an exception if the type is not found. | .gif) | GetType(String, Boolean, Boolean) | Gets the Type object with the specified name in the assembly instance, with the options of ignoring the case, and of throwing an exception if the type is not found. | .gif) .gif) .gif) | GetTypes | Gets the types defined in this assembly. | .gif) .gif) .gif) | IsDefined | Indicates whether or not a specified attribute has been applied to the assembly. | .gif) .gif) .gif) | Load(AssemblyName) | Loads an assembly given its AssemblyName. | .gif) .gif) | Load(array<Byte>[]()[]) | Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly. The assembly is loaded into the application domain of the caller. | .gif) .gif) .gif) .gif) | Load(String) | Loads an assembly given the long form of its name. | .gif) .gif) | Load(AssemblyName, Evidence) | Obsolete. Loads an assembly given its AssemblyName. The assembly is loaded into the domain of the caller using the supplied evidence. | .gif) .gif) | Load(array<Byte>[]()[], array<Byte>[]()[]) | Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly, optionally including symbols for the assembly. The assembly is loaded into the application domain of the caller. | .gif) .gif) | Load(String, Evidence) | Obsolete. Loads an assembly given its display name, loading the assembly into the domain of the caller using the supplied evidence. | .gif) .gif) | Load(array<Byte>[]()[], array<Byte>[]()[], Evidence) | Obsolete. Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly, optionally including symbols and evidence for the assembly. The assembly is loaded into the application domain of the caller. | .gif) .gif) | Load(array<Byte>[]()[], array<Byte>[]()[], SecurityContextSource) | Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly, optionally including symbols and specifying the source for the security context. The assembly is loaded into the application domain of the caller. | .gif) .gif) | LoadFile(String) | Loads the contents of an assembly file on the specified path. | .gif) .gif) | LoadFile(String, Evidence) | Obsolete. Loads an assembly given its path, loading the assembly into the domain of the caller using the supplied evidence. | .gif) .gif) .gif) | LoadFrom(String) | Loads an assembly given its file name or path. | .gif) .gif) | LoadFrom(String, Evidence) | Obsolete. Loads an assembly given its file name or path and supplying security evidence. | .gif) .gif) | LoadFrom(String, array<Byte>[]()[], AssemblyHashAlgorithm) | Loads an assembly given its file name or path, hash value, and hash algorithm. | .gif) .gif) | LoadFrom(String, Evidence, array<Byte>[]()[], AssemblyHashAlgorithm) | Obsolete. Loads an assembly given its file name or path, security evidence, hash value, and hash algorithm. | .gif) | LoadModule(String, array<Byte>[]()[]) | Loads the module, internal to this assembly, with a common object file format (COFF)-based image containing an emitted module, or a resource file. | .gif) | LoadModule(String, array<Byte>[]()[], array<Byte>[]()[]) | Loads the module, internal to this assembly, with a common object file format (COFF)-based image containing an emitted module, or a resource file. The raw bytes representing the symbols for the module are also loaded. | .gif) .gif) | LoadWithPartialName(String) | Obsolete. Loads an assembly from the application directory or from the global assembly cache using a partial name. | .gif) .gif) | LoadWithPartialName(String, Evidence) | Obsolete. Loads an assembly from the application directory or from the global assembly cache using a partial name. The assembly is loaded into the domain of the caller using the supplied evidence. | .gif) .gif) .gif) | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | .gif) .gif) | ReflectionOnlyLoad(array<Byte>[]()[]) | Loads the assembly from a common object file format (COFF)-based image containing an emitted assembly. The assembly is loaded into the reflection-only context of the caller's application domain. | .gif) .gif) | ReflectionOnlyLoad(String) | Loads an assembly into the reflection-only context, given its display name. | .gif) .gif) | ReflectionOnlyLoadFrom | Loads an assembly into the reflection-only context, given its path. | .gif) .gif) .gif) | ToString | Returns the full name of the assembly, also known as the display name. (Overrides Object..::.ToString()()().) | .gif) .gif) | UnsafeLoadFrom | Loads an assembly into the load-from context, bypassing some security checks. | Top

Events
|
| Name | Description |
|---|
.gif) | ModuleResolve | Occurs when the common language runtime class loader cannot resolve a reference to an internal module of an assembly through normal means. | Top

Explicit Interface Implementations

Remarks
Use the Assembly class to load assemblies, to explore the metadata and constituent parts of assemblies, to discover the types contained in assemblies, and to create instances of those types. To get an array of Assembly objects representing the assemblies currently loaded into an application domain (for example, the default application domain of a simple project), use the AppDomain..::.GetAssemblies method. To load assemblies dynamically, the Assembly class provides the following static methods (Shared methods in Visual Basic). Assemblies are loaded into the application domain where the load operation occurs. The recommended way to load assemblies is to use the Load method, which identifies the assembly to be loaded by its display name (for example, "System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"). The search for the assembly follows the rules described in How the Runtime Locates Assemblies. The ReflectionOnlyLoad and ReflectionOnlyLoadFrom methods enable you to load an assembly for reflection, but not for execution. For example, an assembly that targets a 64-bit platform can be examined by code that is running on a 32-bit platform. The LoadFile and LoadFrom methods are provided for rare scenarios in which an assembly must be identified by path.
To get an Assembly object for the currently executing assembly, use the GetExecutingAssembly method. Many members of the Assembly class provide information about an assembly. For example: The GetName method returns an AssemblyName object that provides access to the parts of the assembly display name. The GetCustomAttributes method lists the attributes applied to the assembly. The GetFiles method provides access to the files in the assembly manifest. The GetManifestResourceNames method provides the names of the resources in the assembly manifest.
The GetTypes method lists all the types in the assembly. The GetExportedTypes method lists the types that are visible to callers outside the assembly. The GetType method can be used to search for a particular type in the assembly. The CreateInstance method can be used to search for and create instances of types in the assembly. For more information on assemblies, see Application Domains and Assemblies.

Examples
The following code example shows how to obtain the currently executing assembly, create an instance of a type contained in that assembly, and invoke one of the type's methods with late binding. For this purpose, the code example defines a class named Example, with a method named SampleMethod. The constructor of the class accepts an integer, which is used to compute the return value of the method. The code example also demonstrates the use of the GetName method to obtain an AssemblyName object that can be used to parse the full name of the assembly. The example displays the version number of the assembly, the CodeBase property, and the EntryPoint property.
Imports System
Imports System.Reflection
Imports System.Security.Permissions
<assembly: AssemblyVersionAttribute("1.0.2000.0")>
Public Class Example
Private factor As Integer
Public Sub New(ByVal f As Integer)
factor = f
End Sub
Public Function SampleMethod(ByVal x As Integer) As Integer
Console.WriteLine(vbCrLf & "Example.SampleMethod({0}) executes.", x)
Return x * factor
End Function
Public Shared Sub Main()
Dim assem As [Assembly] = [Assembly].GetExecutingAssembly()
Console.WriteLine("Assembly Full Name:")
Console.WriteLine(assem.FullName)
' The AssemblyName type can be used to parse the full name.
Dim assemName As AssemblyName = assem.GetName()
Console.WriteLine(vbLf + "Name: {0}", assemName.Name)
Console.WriteLine("Version: {0}.{1}", assemName.Version.Major, _
assemName.Version.Minor)
Console.WriteLine(vbLf + "Assembly CodeBase:")
Console.WriteLine(assem.CodeBase)
' Create an object from the assembly, passing in the correct number
' and type of arguments for the constructor.
Dim o As Object = assem.CreateInstance("Example", False, _
BindingFlags.ExactBinding, Nothing, _
New Object() { 2 }, Nothing, Nothing)
' Make a late-bound call to an instance method of the object.
Dim m As MethodInfo = assem.GetType("Example").GetMethod("SampleMethod")
Dim ret As Object = m.Invoke(o, New Object() { 42 })
Console.WriteLine("SampleMethod returned {0}.", ret)
Console.WriteLine(vbCrLf & "Assembly entry point:")
Console.WriteLine(assem.EntryPoint)
End Sub
End Class
' This code example produces output similar to the following:
'
'Assembly Full Name:
'source, Version=1.0.2000.0, Culture=neutral, PublicKeyToken=null
'
'Name: source
'Version: 1.0
'
'Assembly CodeBase:
'file:///C:/sdtree/AssemblyClass/vb/source.exe
'
'Example.SampleMethod(42) executes.
'SampleMethod returned 84.
'
'Assembly entry point:
'Void Main()
'
using System;
using System.Reflection;
using System.Security.Permissions;
[assembly:AssemblyVersionAttribute("1.0.2000.0")]
public class Example
{
private int factor;
public Example(int f)
{
factor = f;
}
public int SampleMethod(int x)
{
Console.WriteLine("\nExample.SampleMethod({0}) executes.", x);
return x * factor;
}
public static void Main()
{
Assembly assem = Assembly.GetExecutingAssembly();
Console.WriteLine("Assembly Full Name:");
Console.WriteLine(assem.FullName);
// The AssemblyName type can be used to parse the full name.
AssemblyName assemName = assem.GetName();
Console.WriteLine("\nName: {0}", assemName.Name);
Console.WriteLine("Version: {0}.{1}",
assemName.Version.Major, assemName.Version.Minor);
Console.WriteLine("\nAssembly CodeBase:");
Console.WriteLine(assem.CodeBase);
// Create an object from the assembly, passing in the correct number
// and type of arguments for the constructor.
Object o = assem.CreateInstance("Example", false,
BindingFlags.ExactBinding,
null, new Object[] { 2 }, null, null);
// Make a late-bound call to an instance method of the object.
MethodInfo m = assem.GetType("Example").GetMethod("SampleMethod");
Object ret = m.Invoke(o, new Object[] { 42 });
Console.WriteLine("SampleMethod returned {0}.", ret);
Console.WriteLine("\nAssembly entry point:");
Console.WriteLine(assem.EntryPoint);
}
}
/* This code example produces output similar to the following:
Assembly Full Name:
source, Version=1.0.2000.0, Culture=neutral, PublicKeyToken=null
Name: source
Version: 1.0
Assembly CodeBase:
file:///C:/sdtree/AssemblyClass/cs/source.exe
Example.SampleMethod(42) executes.
SampleMethod returned 84.
Assembly entry point:
Void Main()
*/
using namespace System;
using namespace System::Reflection;
using namespace System::Security::Permissions;
[assembly:AssemblyVersionAttribute("1.0.2000.0")];
public ref class Example
{
private:
int factor;
public:
Example(int f)
{
factor = f;
}
int SampleMethod(int x)
{
Console::WriteLine("\nExample->SampleMethod({0}) executes.", x);
return x * factor;
}
};
void main()
{
Assembly^ assem = Assembly::GetExecutingAssembly();
Console::WriteLine("Assembly Full Name:");
Console::WriteLine(assem->FullName);
// The AssemblyName type can be used to parse the full name.
AssemblyName^ assemName = assem->GetName();
Console::WriteLine("\nName: {0}", assemName->Name);
Console::WriteLine("Version: {0}.{1}",
assemName->Version->Major, assemName->Version->Minor);
Console::WriteLine("\nAssembly CodeBase:");
Console::WriteLine(assem->CodeBase);
// Create an object from the assembly, passing in the correct number and
// type of arguments for the constructor.
Object^ o = assem->CreateInstance("Example", false,
BindingFlags::ExactBinding,
nullptr, gcnew array<Object^> { 2 }, nullptr, nullptr);
// Make a late-bound call to an instance method of the object.
MethodInfo^ m = assem->GetType("Example")->GetMethod("SampleMethod");
Object^ ret = m->Invoke(o, gcnew array<Object^> { 42 });
Console::WriteLine("SampleMethod returned {0}.", ret);
Console::WriteLine("\nAssembly entry point:");
Console::WriteLine(assem->EntryPoint);
}
/* This code example produces output similar to the following:
Assembly Full Name:
source, Version=1.0.2000.0, Culture=neutral, PublicKeyToken=null
Name: source
Version: 1.0
Assembly CodeBase:
file:///C:/sdtree/AssemblyClass/cpp/source.exe
Example->SampleMethod(42) executes.
SampleMethod returned 84.
Assembly entry point:
UInt32 _mainCRTStartup()
*/

Version Information
.NET FrameworkSupported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0 .NET Framework Client ProfileSupported in: 4, 3.5 SP1 Portable Class LibrarySupported in: Portable Class Library

.NET Framework Security

Platforms
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Thread Safety
This type is thread safe.

See Also
|
Biblioteca de clases de .NET Framework Assembly (Clase) Representa un ensamblado, que es un bloque de creación reutilizable, versionable y autodescriptivo de una aplicación de Common Language Runtime.

Jerarquía de herencia
Espacio de nombres:
System.Reflection
Ensamblado:
mscorlib (en mscorlib.dll)

Sintaxis
<SerializableAttribute> _
<ComVisibleAttribute(True)> _
<ClassInterfaceAttribute(ClassInterfaceType.None)> _
<PermissionSetAttribute(SecurityAction.InheritanceDemand, Unrestricted := True)> _
Public MustInherit Class Assembly _
Implements _Assembly, IEvidenceFactory, ICustomAttributeProvider, ISerializable
[SerializableAttribute]
[ComVisibleAttribute(true)]
[ClassInterfaceAttribute(ClassInterfaceType.None)]
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Unrestricted = true)]
public abstract class Assembly : _Assembly,
IEvidenceFactory, ICustomAttributeProvider, ISerializable
[SerializableAttribute]
[ComVisibleAttribute(true)]
[ClassInterfaceAttribute(ClassInterfaceType::None)]
[PermissionSetAttribute(SecurityAction::InheritanceDemand, Unrestricted = true)]
public ref class Assembly abstract : _Assembly,
IEvidenceFactory, ICustomAttributeProvider, ISerializable
[<AbstractClass>]
[<SerializableAttribute>]
[<ComVisibleAttribute(true)>]
[<ClassInterfaceAttribute(ClassInterfaceType.None)>]
[<PermissionSetAttribute(SecurityAction.InheritanceDemand, Unrestricted = true)>]
type Assembly =
class
interface _Assembly
interface IEvidenceFactory
interface ICustomAttributeProvider
interface ISerializable
end
El tipo Assembly expone los siguientes miembros.

Constructores
|
| Nombre | Descripción |
|---|
.gif) | Assembly | Inicializa una nueva instancia de la clase Assembly. | Arriba

Métodos
|
| Nombre | Descripción |
|---|
.gif) .gif) | CreateInstance(String) | Ubica el tipo especificado en este ensamblado y crea una instancia del mismo mediante el activador del sistema, realizando una búsqueda en la que se distingue entre mayúsculas y minúsculas. | .gif) | CreateInstance(String, Boolean) | Ubica el tipo especificado de este ensamblado y crea una instancia del mismo mediante el activador del sistema, con búsqueda de mayúsculas y minúsculas opcional. | .gif) | CreateInstance(String, Boolean, BindingFlags, Binder, array<Object>[]()[], CultureInfo, array<Object>[]()[]) | Ubica el tipo especificado en este ensamblado y crea una instancia del mismo mediante el activador del sistema, con búsqueda de mayúsculas y minúsculas opcional y con los atributos de referencia cultural, argumentos, enlace y activación. | .gif) .gif) | CreateQualifiedName | Crea el nombre de un tipo calificado con el nombre de presentación de su ensamblado. | .gif) .gif) .gif) | Equals | Determina si este ensamblado y el objeto especificado son iguales. (Invalida a Object..::.Equals(Object)).
En XNA Framework 3.0, este miembro se hereda de Object..::.Equals(Object).
En , este miembro se hereda de Object..::.Equals(Object). | .gif) .gif) .gif) | Finalize | Permite que un objeto intente liberar recursos y realizar otras operaciones de limpieza antes de ser reclamado por la recolección de elementos no utilizados. (Se hereda de Object). | .gif) .gif) | GetAssembly | Obtiene el ensamblado cargado actualmente donde se define la clase especificada. | .gif) .gif) .gif) .gif) | GetCallingAssembly | Devuelve el objeto Assembly del método al que llamó el método actualmente en ejecución. | .gif) .gif) .gif) | GetCustomAttributes(Boolean) | Obtiene los atributos personalizados para este ensamblado. | .gif) .gif) .gif) | GetCustomAttributes(Type, Boolean) | Obtiene los atributos personalizados para este ensamblado tal y como lo especifica el tipo. | .gif) | GetCustomAttributesData | Devuelve información sobre los atributos que se han aplicado a la clase Assembly actual, expresada como objetos CustomAttributeData. | .gif) .gif) | GetEntryAssembly | Obtiene el ejecutable de procesos en el dominio de la aplicación predeterminada. En otros dominios de la aplicación, este es el primer ejecutable que AppDomain..::.ExecuteAssembly ejecuta. | .gif) .gif) .gif) .gif) | GetExecutingAssembly | Obtiene el ensamblado que contiene el código que se está ejecutando actualmente. | .gif) | GetExportedTypes | Obtiene los tipos públicos definidos en este ensamblado que se pueden ver desde fuera del ensamblado. | .gif) | GetFile | Obtiene un FileStream para el archivo especificado en la tabla de archivos del manifiesto de este ensamblado. | .gif) | GetFiles()()() | Obtiene los archivos en la tabla de archivos de un manifiesto de ensamblado. | .gif) | GetFiles(Boolean) | Obtiene los archivos en la tabla de archivos de un manifiesto de ensamblado, especificando si deben incluirse módulos de recursos. | .gif) .gif) .gif) | GetHashCode | Devuelve el código hash de esta instancia. (Invalida a Object..::.GetHashCode()()()).
En XNA Framework 3.0, este miembro se hereda de Object..::.GetHashCode()()().
En , este miembro se hereda de Object..::.GetHashCode()()(). | .gif) | GetLoadedModules()()() | Obtiene todos los módulos cargados que forman parte de este ensamblado. | .gif) | GetLoadedModules(Boolean) | Obtiene todos los módulos cargados que forman parte de este ensamblado, especificando si se deben incluir módulos de recursos. | .gif) | GetManifestResourceInfo | Devuelve información sobre cómo el recurso dado ha persistido. | .gif) .gif) .gif) | GetManifestResourceNames | Devuelve los nombres de todos los recursos de este ensamblado. | .gif) .gif) .gif) | GetManifestResourceStream(String) | Carga el recurso del manifiesto especificado a partir de este ensamblado. | .gif) .gif) .gif) | GetManifestResourceStream(Type, String) | Carga el recurso del manifiesto especificado según el espacio de nombres del tipo especificado a partir de este ensamblado. | .gif) | GetModule | Obtiene el módulo especificado en este ensamblado. | .gif) .gif) .gif) | GetModules()()() | Obtiene todos los módulos que forman parte de este ensamblado. | .gif) | GetModules(Boolean) | Obtiene todos los módulos que forman parte de este ensamblado e indica si se deben incluir módulos de recursos. | .gif) .gif) | GetName()()() | Obtiene un objeto AssemblyName para este ensamblado. | .gif) .gif) | GetName(Boolean) | Obtiene un AssemblyName para este ensamblado, estableciendo el código base tal y como se especifica en copiedName. | .gif) | GetObjectData | Obtiene información de serialización con todos los datos necesarios para crear una nueva instancia de este ensamblado. | .gif) | GetReferencedAssemblies | Obtiene los objetos AssemblyName para todos los ensamblados a los que hace referencia este ensamblado. | .gif) .gif) .gif) | GetSatelliteAssembly(CultureInfo) | Obtiene el ensamblado satélite para la referencia cultural especificada. | .gif) .gif) .gif) | GetSatelliteAssembly(CultureInfo, Version) | Obtiene la versión especificada del ensamblado satélite para la referencia cultural especificada. | .gif) .gif) .gif) | GetType()()() | Obtiene el objeto Type de la instancia actual. (Se hereda de Object). | .gif) .gif) .gif) | GetType(String) | Obtiene el objeto Type con el nombre especificado en la instancia del ensamblado. | .gif) .gif) .gif) | GetType(String, Boolean) | Obtiene el objeto Type con el nombre especificado en la instancia del ensamblado y, opcionalmente, produce una excepción si no se encuentra el tipo. | .gif) | GetType(String, Boolean, Boolean) | Obtiene el objeto Type con el nombre especificado en la instancia del ensamblado, con las opciones para omitir el caso y producir una excepción si no se encuentra el tipo. | .gif) .gif) .gif) | GetTypes | Obtiene los tipos definidos en este ensamblado. | .gif) .gif) .gif) | IsDefined | Indica si se ha aplicado o no un atributo especificado al ensamblado. | .gif) .gif) .gif) | Load(AssemblyName) | Carga un ensamblado determinado a partir de su AssemblyName. | .gif) .gif) | Load(array<Byte>[]()[]) | Carga el ensamblado con una imagen que toma como base el formato Common Object File Format (COFF) y que contiene un ensamblado emitido. El ensamblado se carga en el dominio de aplicación del llamador. | .gif) .gif) .gif) .gif) | Load(String) | Carga un ensamblado a partir de su nombre largo. | .gif) .gif) | Load(AssemblyName, Evidence) | Obsoleto. Carga un ensamblado determinado a partir de su AssemblyName. El ensamblado se carga en el dominio del llamador con la evidencia proporcionada. | .gif) .gif) | Load(array<Byte>[]()[], array<Byte>[]()[]) | Carga el ensamblado con una imagen que toma como base el formato Common Object File Format (COFF) que contiene un ensamblado emitido, incluyendo opcionalmente los símbolos del ensamblado. El ensamblado se carga en el dominio de aplicación del llamador. | .gif) .gif) | Load(String, Evidence) | Obsoleto. Carga un ensamblado determinado a partir de su nombre de presentación, cargando el ensamblado en el dominio del llamador mediante la evidencia proporcionada. | .gif) .gif) | Load(array<Byte>[]()[], array<Byte>[]()[], Evidence) | Obsoleto. Carga el ensamblado con una imagen que toma como base el formato Common Object File Format (COFF) que contiene un ensamblado emitido, incluyendo opcionalmente los símbolos y la evidencia del ensamblado. El ensamblado se carga en el dominio de aplicación del llamador. | .gif) .gif) | Load(array<Byte>[]()[], array<Byte>[]()[], SecurityContextSource) | Carga el ensamblado con una imagen que toma como base el formato Common Object File Format (COFF) que contiene un ensamblado emitido, incluyendo opcionalmente los símbolos y especificando el origen del contexto de seguridad. El ensamblado se carga en el dominio de aplicación del llamador. | .gif) .gif) | LoadFile(String) | Carga el contenido de un archivo de ensamblado en la ruta de acceso especificada. | .gif) .gif) | LoadFile(String, Evidence) | Obsoleto. Carga un ensamblado a partir de su ruta de acceso, cargando el ensamblado en el dominio del llamador mediante la evidencia proporcionada. | .gif) .gif) .gif) | LoadFrom(String) | Carga un ensamblado a partir del nombre o ruta de acceso del archivo. | .gif) .gif) | LoadFrom(String, Evidence) | Obsoleto. Carga un ensamblado determinado a partir del nombre o ruta de acceso del archivo, a la vez que proporciona evidencia de seguridad. | .gif) .gif) | LoadFrom(String, array<Byte>[]()[], AssemblyHashAlgorithm) | Carga un ensamblado a partir de su nombre o ruta de acceso de archivo, valor hash y algoritmo hash. | .gif) .gif) | LoadFrom(String, Evidence, array<Byte>[]()[], AssemblyHashAlgorithm) | Obsoleto. Carga un ensamblado a partir de su nombre o ruta de acceso de archivo, evidencia de seguridad, valor hash y algoritmo hash. | .gif) | LoadModule(String, array<Byte>[]()[]) | Carga el módulo, que es interno para este ensamblado, con una imagen que toma como base el formato Common Object File Format (COFF) y que contiene un módulo emitido o un archivo de recursos. | .gif) | LoadModule(String, array<Byte>[]()[], array<Byte>[]()[]) | Carga el módulo, que es interno para este ensamblado, con una imagen que toma como base el formato Common Object File Format (COFF) y que contiene un módulo emitido o un archivo de recursos. También se cargan los bytes sin formato que representan a los símbolos del módulo. | .gif) .gif) | LoadWithPartialName(String) | Obsoleto. Carga un ensamblado desde el directorio de la aplicación o desde la caché global de ensamblados utilizando un nombre parcial. | .gif) .gif) | LoadWithPartialName(String, Evidence) | Obsoleto. Carga un ensamblado desde el directorio de la aplicación o desde la caché global de ensamblados utilizando un nombre parcial. El ensamblado se carga en el dominio del llamador con la evidencia proporcionada. | .gif) .gif) .gif) | MemberwiseClone | Crea una copia superficial del objeto Object actual. (Se hereda de Object). | .gif) .gif) | ReflectionOnlyLoad(array<Byte>[]()[]) | Carga el ensamblado desde una imagen que toma como base el formato Common Object File Format (COFF) y que contiene un ensamblado emitido. El ensamblado se carga en el contexto de sólo reflexión del dominio de aplicación del llamador. | .gif) .gif) | ReflectionOnlyLoad(String) | Carga un ensamblado en el contexto de sólo reflexión, de acuerdo con su nombre de presentación. | .gif) .gif) | ReflectionOnlyLoadFrom | Carga un ensamblado en el contexto de sólo reflexión, de acuerdo con su ruta de acceso. | .gif) .gif) .gif) | ToString | Devuelve el nombre completo del ensamblado, también conocido como nombre de presentación. (Invalida a Object..::.ToString()()()). | .gif) .gif) | UnsafeLoadFrom | Carga un ensamblado en el contexto de origen de carga, omitiendo algunas comprobaciones de seguridad. | Arriba

Eventos
|
| Nombre | Descripción |
|---|
.gif) | ModuleResolve | Se produce cuando el cargador de clases Common Language Runtime no puede resolver una referencia a un módulo interno de un ensamblado por medios normales. | Arriba

Implementaciones explícitas de interfaces

Comentarios
Utilice la clase Assembly para cargar los ensamblados, explorar los metadatos y las partes constituyentes de los ensamblados, detectar los tipos incluidos en los ensamblados y crear instancias de esos tipos. Para obtener una matriz de objetos Assembly que represente los ensamblados que actualmente están cargados en un dominio de aplicación (por ejemplo, el dominio de aplicación predeterminado de un proyecto simple), utilice el método AppDomain..::.GetAssemblies. Para cargar ensamblados dinámicamente, la clase Assembly proporciona los métodos estáticos siguientes (métodos Shared en Visual Basic). Los ensamblados se cargan en el dominio de aplicación en que se produce la operación de carga. Se recomienda cargar los ensamblados utilizando el método Load, que identifica el ensamblado que se va a cargar mediante su nombre para mostrar (por ejemplo, "System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"). La búsqueda del ensamblado se rige por las normas descritas en Cómo el motor en tiempo de ejecución ubica ensamblados. Los métodos ReflectionOnlyLoad y ReflectionOnlyLoadFrom permiten cargar un ensamblado para su reflexión, pero no para su ejecución. Por ejemplo, un ensamblado que tiene como destino una plataforma de 64 bits puede ser examinado por el código que se ejecuta en una plataforma de 32 bits. Los métodos LoadFile y LoadFrom se proporcionan para aquellas situaciones poco habituales en que un ensamblado debe identificarse mediante una ruta de acceso.
Si desea obtener un objeto Assembly para el ensamblado que se encuentra actualmente en ejecución, utilice el método GetExecutingAssembly. Muchos miembros de la clase Assembly proporcionan información sobre un ensamblado. Por ejemplo: El método GetName devuelve un objeto AssemblyName que proporciona acceso a las partes del nombre para mostrar del ensamblado. El método GetCustomAttributes muestra los atributos que se aplican al ensamblado. El método GetFiles proporciona acceso a los archivos del manifiesto del ensamblado. El método GetManifestResourceNames proporciona los nombres de los recursos del manifiesto del ensamblado.
El método GetTypes muestra todos los tipos del ensamblado. El método GetExportedTypes indica los tipos que los llamadores pueden ver desde fuera del ensamblado. El método GetType se puede utilizar para buscar un tipo determinado en el ensamblado. El método CreateInstance se puede utilizar para buscar y crear instancias de tipos en el ensamblado. Para obtener más información sobre los ensamblados, vea Dominios de aplicación y ensamblados.

Ejemplos
En el ejemplo de código siguiente se muestra cómo se obtiene el ensamblado que se está ejecutando en la actualidad, cómo se crea una instancia de un tipo incluido en este ensamblado y cómo se llama a uno de los métodos del tipo con enlace en tiempo de ejecución. Para este fin, en el ejemplo de código se define una clase denominada Example con un método denominado SampleMethod. El constructor de la clase acepta un entero, que se utiliza para calcular el valor devuelto del método. En el ejemplo de código también se muestra cómo se utiliza el método GetName para obtener un objeto AssemblyName que se puede utilizar para analizar el nombre completo del ensamblado. En el ejemplo se muestra el número de versión del ensamblado, la propiedad CodeBase y la propiedad EntryPoint.
Imports System
Imports System.Reflection
Imports System.Security.Permissions
<assembly: AssemblyVersionAttribute("1.0.2000.0")>
Public Class Example
Private factor As Integer
Public Sub New(ByVal f As Integer)
factor = f
End Sub
Public Function SampleMethod(ByVal x As Integer) As Integer
Console.WriteLine(vbCrLf & "Example.SampleMethod({0}) executes.", x)
Return x * factor
End Function
Public Shared Sub Main()
Dim assem As [Assembly] = [Assembly].GetExecutingAssembly()
Console.WriteLine("Assembly Full Name:")
Console.WriteLine(assem.FullName)
' The AssemblyName type can be used to parse the full name.
Dim assemName As AssemblyName = assem.GetName()
Console.WriteLine(vbLf + "Name: {0}", assemName.Name)
Console.WriteLine("Version: {0}.{1}", assemName.Version.Major, _
assemName.Version.Minor)
Console.WriteLine(vbLf + "Assembly CodeBase:")
Console.WriteLine(assem.CodeBase)
' Create an object from the assembly, passing in the correct number
' and type of arguments for the constructor.
Dim o As Object = assem.CreateInstance("Example", False, _
BindingFlags.ExactBinding, Nothing, _
New Object() { 2 }, Nothing, Nothing)
' Make a late-bound call to an instance method of the object.
Dim m As MethodInfo = assem.GetType("Example").GetMethod("SampleMethod")
Dim ret As Object = m.Invoke(o, New Object() { 42 })
Console.WriteLine("SampleMethod returned {0}.", ret)
Console.WriteLine(vbCrLf & "Assembly entry point:")
Console.WriteLine(assem.EntryPoint)
End Sub
End Class
' This code example produces output similar to the following:
'
'Assembly Full Name:
'source, Version=1.0.2000.0, Culture=neutral, PublicKeyToken=null
'
'Name: source
'Version: 1.0
'
'Assembly CodeBase:
'file:///C:/sdtree/AssemblyClass/vb/source.exe
'
'Example.SampleMethod(42) executes.
'SampleMethod returned 84.
'
'Assembly entry point:
'Void Main()
'
using System;
using System.Reflection;
using System.Security.Permissions;
[assembly:AssemblyVersionAttribute("1.0.2000.0")]
public class Example
{
private int factor;
public Example(int f)
{
factor = f;
}
public int SampleMethod(int x)
{
Console.WriteLine("\nExample.SampleMethod({0}) executes.", x);
return x * factor;
}
public static void Main()
{
Assembly assem = Assembly.GetExecutingAssembly();
Console.WriteLine("Assembly Full Name:");
Console.WriteLine(assem.FullName);
// The AssemblyName type can be used to parse the full name.
AssemblyName assemName = assem.GetName();
Console.WriteLine("\nName: {0}", assemName.Name);
Console.WriteLine("Version: {0}.{1}",
assemName.Version.Major, assemName.Version.Minor);
Console.WriteLine("\nAssembly CodeBase:");
Console.WriteLine(assem.CodeBase);
// Create an object from the assembly, passing in the correct number
// and type of arguments for the constructor.
Object o = assem.CreateInstance("Example", false,
BindingFlags.ExactBinding,
null, new Object[] { 2 }, null, null);
// Make a late-bound call to an instance method of the object.
MethodInfo m = assem.GetType("Example").GetMethod("SampleMethod");
Object ret = m.Invoke(o, new Object[] { 42 });
Console.WriteLine("SampleMethod returned {0}.", ret);
Console.WriteLine("\nAssembly entry point:");
Console.WriteLine(assem.EntryPoint);
}
}
/* This code example produces output similar to the following:
Assembly Full Name:
source, Version=1.0.2000.0, Culture=neutral, PublicKeyToken=null
Name: source
Version: 1.0
Assembly CodeBase:
file:///C:/sdtree/AssemblyClass/cs/source.exe
Example.SampleMethod(42) executes.
SampleMethod returned 84.
Assembly entry point:
Void Main()
*/
using namespace System;
using namespace System::Reflection;
using namespace System::Security::Permissions;
[assembly:AssemblyVersionAttribute("1.0.2000.0")];
public ref class Example
{
private:
int factor;
public:
Example(int f)
{
factor = f;
}
int SampleMethod(int x)
{
Console::WriteLine("\nExample->SampleMethod({0}) executes.", x);
return x * factor;
}
};
void main()
{
Assembly^ assem = Assembly::GetExecutingAssembly();
Console::WriteLine("Assembly Full Name:");
Console::WriteLine(assem->FullName);
// The AssemblyName type can be used to parse the full name.
AssemblyName^ assemName = assem->GetName();
Console::WriteLine("\nName: {0}", assemName->Name);
Console::WriteLine("Version: {0}.{1}",
assemName->Version->Major, assemName->Version->Minor);
Console::WriteLine("\nAssembly CodeBase:");
Console::WriteLine(assem->CodeBase);
// Create an object from the assembly, passing in the correct number and
// type of arguments for the constructor.
Object^ o = assem->CreateInstance("Example", false,
BindingFlags::ExactBinding,
nullptr, gcnew array<Object^> { 2 }, nullptr, nullptr);
// Make a late-bound call to an instance method of the object.
MethodInfo^ m = assem->GetType("Example")->GetMethod("SampleMethod");
Object^ ret = m->Invoke(o, gcnew array<Object^> { 42 });
Console::WriteLine("SampleMethod returned {0}.", ret);
Console::WriteLine("\nAssembly entry point:");
Console::WriteLine(assem->EntryPoint);
}
/* This code example produces output similar to the following:
Assembly Full Name:
source, Version=1.0.2000.0, Culture=neutral, PublicKeyToken=null
Name: source
Version: 1.0
Assembly CodeBase:
file:///C:/sdtree/AssemblyClass/cpp/source.exe
Example->SampleMethod(42) executes.
SampleMethod returned 84.
Assembly entry point:
UInt32 _mainCRTStartup()
*/

Información de versión
.NET FrameworkCompatible con: 4, 3.5, 3.0, 2.0, 1.1, 1.0 .NET Framework Client ProfileCompatible con: 4, 3.5 SP1 Compatible con:

Seguridad de .NET Framework

Plataformas
Windows 7, Windows Vista SP1 o posterior, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (no se admite Server Core), Windows Server 2008 R2 (se admite Server Core con SP1 o posterior), Windows Server 2003 SP2
.NET Framework no admite todas las versiones de todas las plataformas. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

Seguridad para subprocesos
Este tipo es seguro para la ejecución de subprocesos.

Vea también
|