Module Clase
Definición
Realiza una reflexión en un módulo.Performs reflection on a module.
public ref class Module abstract
public ref class Module abstract : System::Reflection::ICustomAttributeProvider, System::Runtime::Serialization::ISerializable
public ref class Module abstract : System::Reflection::ICustomAttributeProvider
public ref class Module : System::Reflection::ICustomAttributeProvider, System::Runtime::InteropServices::_Module, System::Runtime::Serialization::ISerializable
public ref class Module abstract : System::Reflection::ICustomAttributeProvider, System::Runtime::InteropServices::_Module, System::Runtime::Serialization::ISerializable
public abstract class Module
public abstract class Module : System.Reflection.ICustomAttributeProvider, System.Runtime.Serialization.ISerializable
public abstract class Module : System.Reflection.ICustomAttributeProvider
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Serializable]
public class Module : System.Reflection.ICustomAttributeProvider, System.Runtime.InteropServices._Module, System.Runtime.Serialization.ISerializable
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public class Module : System.Reflection.ICustomAttributeProvider, System.Runtime.InteropServices._Module, System.Runtime.Serialization.ISerializable
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class Module : System.Reflection.ICustomAttributeProvider, System.Runtime.InteropServices._Module, System.Runtime.Serialization.ISerializable
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class Module : System.Reflection.ICustomAttributeProvider, System.Runtime.Serialization.ISerializable
type Module = class
type Module = class
interface ICustomAttributeProvider
interface ISerializable
type Module = class
interface ICustomAttributeProvider
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)>]
[<System.Serializable>]
type Module = class
interface _Module
interface ISerializable
interface ICustomAttributeProvider
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)>]
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type Module = class
interface _Module
interface ISerializable
interface ICustomAttributeProvider
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)>]
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type Module = class
interface ISerializable
interface ICustomAttributeProvider
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)>]
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type Module = class
interface ISerializable
interface ICustomAttributeProvider
interface _Module
Public MustInherit Class Module
Public MustInherit Class Module
Implements ICustomAttributeProvider, ISerializable
Public MustInherit Class Module
Implements ICustomAttributeProvider
Public Class Module
Implements _Module, ICustomAttributeProvider, ISerializable
Public MustInherit Class Module
Implements _Module, ICustomAttributeProvider, ISerializable
- Herencia
-
Module
- Derivado
- Atributos
- Implementaciones
Ejemplos
En los siguientes ejemplos de código se muestra cómo usar la reflexión para obtener información acerca de los módulos:The following code examples show how to use reflection to get information about modules:
using System.Reflection;
using System;
public class Program {
public static void Main() {
Class1 c1 = new Class1();
// Show the current module.
Module m = c1.GetType().Module;
Console.WriteLine("The current module is {0}.", m.Name);
// List all modules in the assembly.
Assembly curAssembly = typeof(Program).Assembly;
Console.WriteLine("The current executing assembly is {0}.", curAssembly);
Module[] mods = curAssembly.GetModules();
foreach (Module md in mods) {
Console.WriteLine("This assembly contains the {0} module", md.Name);
}
Console.ReadLine();
}
}
class Class1 {
}
Imports System.Reflection
Public Class Program
Public Shared Sub Main()
Dim c1 As New Class1
' Show the current module.
' Note the brackets around "[Module]" to differentiate
' it from the Visual Basic "Module" keyword.
Dim m As [Module] = c1.GetType().Module
Console.WriteLine("The current module is {0}.", m.Name)
' List all modules in the assembly.
Dim curAssembly As Assembly = GetType(Program).Assembly
Console.WriteLine("The executing assembly is {0}.", curAssembly)
Dim mods() As [Module] = curAssembly.GetModules()
For Each md As [Module] In mods
Console.WriteLine("This assembly contains the {0} module", md.Name)
Next
Console.ReadLine()
End Sub
End Class
Class Class1
End Class
Comentarios
Un módulo es un archivo ejecutable portable, como type.dll o application.exe, que consta de una o varias clases e interfaces.A module is a portable executable file, such as type.dll or application.exe, consisting of one or more classes and interfaces. Puede que haya varios espacios de nombres contenidos en un módulo único y un espacio de nombres puede abarcar a varios módulos.There may be multiple namespaces contained in a single module, and a namespace may span multiple modules.
Un ensamblado está compuesto de uno o varios módulos implementados como una unidad.One or more modules deployed as a unit compose an assembly. Para obtener información sobre cómo crear un ensamblado con más de un módulo, vea ensambladosde varios archivos.For information about creating an assembly with more than one module, see Multifile Assemblies.
Tenga en cuenta que un módulo de .NET Framework no es lo mismo que un módulo en Visual Basic, que es utilizado por los programadores para organizar funciones y subrutinas en una aplicación.Note that a .NET Framework module is not the same as a module in Visual Basic, which is used by a programmers to organize functions and subroutines in an application.
Constructores
Module() |
Inicializa una nueva instancia de la clase Module.Initializes a new instance of the Module class. |
Campos
FilterTypeName |
Objeto |
FilterTypeNameIgnoreCase |
Objeto |
Propiedades
Assembly |
Obtiene el Assembly adecuado para esta instancia de Module.Gets the appropriate Assembly for this instance of Module. |
CustomAttributes |
Obtiene una colección que contiene los atributos personalizados de este módulo.Gets a collection that contains this module's custom attributes. |
FullyQualifiedName |
Obtiene una cadena que representa el nombre completo y la ruta de acceso de este módulo.Gets a string representing the fully qualified name and path to this module. |
MDStreamVersion |
Obtiene la versión del flujo de metadatos.Gets the metadata stream version. |
MetadataToken |
Obtiene un token que identifica el módulo en los metadatos.Gets a token that identifies the module in metadata. |
ModuleHandle |
Obtiene un identificador para el módulo.Gets a handle for the module. |
ModuleVersionId |
Obtiene un identificador único universal (UUID) que puede utilizarse para distinguir entre dos versiones de un módulo.Gets a universally unique identifier (UUID) that can be used to distinguish between two versions of a module. |
Name |
Obtiene una cadena, |
ScopeName |
Obtiene una cadena que representa el nombre del módulo.Gets a string representing the name of the module. |
Métodos
Equals(Object) |
Determina si este módulo y el objeto especificado son iguales.Determines whether this module and the specified object are equal. |
Equals(Object) |
Determina si el objeto especificado es igual que el objeto actual.Determines whether the specified object is equal to the current object. (Heredado de Object) |
FindTypes(TypeFilter, Object) |
Devuelve una matriz de las clases aceptadas por el filtro y los criterios de filtro dados.Returns an array of classes accepted by the given filter and filter criteria. |
GetCustomAttributes(Boolean) |
Devuelve todos los atributos personalizados.Returns all custom attributes. |
GetCustomAttributes(Type, Boolean) |
Obtiene los atributos personalizados del tipo especificado.Gets custom attributes of the specified type. |
GetCustomAttributesData() |
Devuelve una lista de los objetos CustomAttributeData del módulo actual, que puede utilizarse en el contexto de solo reflexión.Returns a list of CustomAttributeData objects for the current module, which can be used in the reflection-only context. |
GetField(String) |
Devuelve un campo que tiene el nombre especificado.Returns a field having the specified name. |
GetField(String, BindingFlags) |
Devuelve un campo que tiene el nombre especificado y atributos de enlace.Returns a field having the specified name and binding attributes. |
GetFields() |
Devuelve los campos globales definidos en el módulo.Returns the global fields defined on the module. |
GetFields(BindingFlags) |
Devuelve los campos globales definidos en el módulo que coinciden con las marcas de enlace especificadas.Returns the global fields defined on the module that match the specified binding flags. |
GetHashCode() |
Devuelve el código hash de esta instancia.Returns the hash code for this instance. |
GetHashCode() |
Sirve como la función hash predeterminada.Serves as the default hash function. (Heredado de Object) |
GetMethod(String) |
Devuelve un método que tiene el nombre especificado.Returns a method having the specified name. |
GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) |
Devuelve un método con el nombre especificado, información de enlace, convención de llamada y tipos de parámetros y modificadores.Returns a method having the specified name, binding information, calling convention, and parameter types and modifiers. |
GetMethod(String, Type[]) |
Devuelve un método con los tipos de parámetro y nombre especificados.Returns a method having the specified name and parameter types. |
GetMethodImpl(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) |
Devuelve la implementación del método conforme a los criterios especificados.Returns the method implementation in accordance with the specified criteria. |
GetMethods() |
Devuelve los métodos globales definidos en el módulo.Returns the global methods defined on the module. |
GetMethods(BindingFlags) |
Devuelve los métodos globales definidos en el módulo que coinciden con las marcas de enlace especificadas.Returns the global methods defined on the module that match the specified binding flags. |
GetObjectData(SerializationInfo, StreamingContext) |
Proporciona una implementación de ISerializable para objetos serializados.Provides an ISerializable implementation for serialized objects. |
GetPEKind(PortableExecutableKinds, ImageFileMachine) |
Obtiene un par de valores que indican la naturaleza del código en un módulo y la plataforma de destino del módulo.Gets a pair of values indicating the nature of the code in a module and the platform targeted by the module. |
GetSignerCertificate() |
Devuelve un objeto |
GetType() |
Obtiene el Type de la instancia actual.Gets the Type of the current instance. (Heredado de Object) |
GetType(String) |
Devuelve el tipo especificado, mediante una búsqueda en la que se distingue entre mayúsculas y minúsculas.Returns the specified type, performing a case-sensitive search. |
GetType(String, Boolean) |
Devuelve el tipo especificado, buscando el módulo con la distinción de mayúsculas y minúsculas especificada.Returns the specified type, searching the module with the specified case sensitivity. |
GetType(String, Boolean, Boolean) |
Devuelve el tipo especificado, indicando si se realiza una búsqueda que distinga entre mayúsculas y minúsculas del módulo y si se produce una excepción si no se puede encontrar el tipo.Returns the specified type, specifying whether to make a case-sensitive search of the module and whether to throw an exception if the type cannot be found. |
GetTypes() |
Devuelve todos los tipos definidos dentro de este módulo.Returns all the types defined within this module. |
IsDefined(Type, Boolean) |
Devuelve un valor que indica si el tipo de atributo especificado se ha aplicado a este módulo.Returns a value that indicates whether the specified attribute type has been applied to this module. |
IsResource() |
Obtiene un valor que indica si el objeto es un recurso.Gets a value indicating whether the object is a resource. |
MemberwiseClone() |
Crea una copia superficial del Object actual.Creates a shallow copy of the current Object. (Heredado de Object) |
ResolveField(Int32) |
Devuelve el campo identificado por el token de metadatos especificado.Returns the field identified by the specified metadata token. |
ResolveField(Int32, Type[], Type[]) |
Devuelve el campo identificado por el token de metadatos especificado, en el contexto definido por los parámetros de tipo genérico especificados.Returns the field identified by the specified metadata token, in the context defined by the specified generic type parameters. |
ResolveMember(Int32) |
Devuelve el tipo o integrante identificado por el token de metadatos especificado.Returns the type or member identified by the specified metadata token. |
ResolveMember(Int32, Type[], Type[]) |
Devuelve el tipo o miembro identificado por el token de metadatos especificado, en el contexto definido por los parámetros de tipo genérico especificados.Returns the type or member identified by the specified metadata token, in the context defined by the specified generic type parameters. |
ResolveMethod(Int32) |
Devuelve el método o constructor identificado por el token de metadatos especificado.Returns the method or constructor identified by the specified metadata token. |
ResolveMethod(Int32, Type[], Type[]) |
Devuelve el método o constructor identificado por el token de metadatos especificado, en el contexto definido por los parámetros de tipo genérico especificados.Returns the method or constructor identified by the specified metadata token, in the context defined by the specified generic type parameters. |
ResolveSignature(Int32) |
Devuelve el objeto binario de firma identificado por un token de metadatos.Returns the signature blob identified by a metadata token. |
ResolveString(Int32) |
Devuelve la cadena identificada por el token de metadatos especificado.Returns the string identified by the specified metadata token. |
ResolveType(Int32) |
Devuelve el tipo identificado por el token de metadatos especificado.Returns the type identified by the specified metadata token. |
ResolveType(Int32, Type[], Type[]) |
Devuelve el campo identificado por el token de metadatos especificado, en el contexto definido por los parámetros de tipo genérico especificados.Returns the type identified by the specified metadata token, in the context defined by the specified generic type parameters. |
ToString() |
Devuelve el nombre del módulo.Returns the name of the module. |
Operadores
Equality(Module, Module) |
Indica si dos objetos Module son iguales.Indicates whether two Module objects are equal. |
Inequality(Module, Module) |
Indica si dos objetos Module no son iguales.Indicates whether two Module objects are not equal. |
Implementaciones de interfaz explícitas
_Module.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
Asigna un conjunto de nombres a un conjunto correspondiente de identificadores de envío.Maps a set of names to a corresponding set of dispatch identifiers. |
_Module.GetTypeInfo(UInt32, UInt32, IntPtr) |
Recupera la información de tipo de un objeto, que se puede usar después para obtener la información de tipo de una interfaz.Retrieves the type information for an object, which can then be used to get the type information for an interface. |
_Module.GetTypeInfoCount(UInt32) |
Recupera el número de interfaces de información de tipo que proporciona un objeto (0 ó 1).Retrieves the number of type information interfaces that an object provides (either 0 or 1). |
_Module.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
Proporciona acceso a las propiedades y los métodos expuestos por un objeto.Provides access to properties and methods exposed by an object. |
ICustomAttributeProvider.GetCustomAttributes(Boolean) |
Devuelve una matriz de todos los atributos personalizados definidos en este miembro, excluidos los atributos con nombre, o una matriz vacía si no hay atributos personalizados.Returns an array of all of the custom attributes defined on this member, excluding named attributes, or an empty array if there are no custom attributes. |
ICustomAttributeProvider.GetCustomAttributes(Type, Boolean) |
Devuelve una matriz de atributos personalizados definidos en este miembro, identificados por tipo, o una matriz vacía si no hay atributos personalizados de ese tipo.Returns an array of custom attributes defined on this member, identified by type, or an empty array if there are no custom attributes of that type. |
ICustomAttributeProvider.IsDefined(Type, Boolean) |
Indica si una o más instancias de |
Métodos de extensión
GetCustomAttribute(Module, Type) |
Recupera un atributo personalizado de un tipo especificado que se aplica a un módulo concreto.Retrieves a custom attribute of a specified type that is applied to a specified module. |
GetCustomAttribute<T>(Module) |
Recupera un atributo personalizado de un tipo especificado que se aplica a un módulo concreto.Retrieves a custom attribute of a specified type that is applied to a specified module. |
GetCustomAttributes(Module) |
Recupera una colección de atributos personalizados que se aplican a un módulo especificado.Retrieves a collection of custom attributes that are applied to a specified module. |
GetCustomAttributes(Module, Type) |
Recupera una colección de atributos personalizados de un tipo especificado que se aplican a un módulo concreto.Retrieves a collection of custom attributes of a specified type that are applied to a specified module. |
GetCustomAttributes<T>(Module) |
Recupera una colección de atributos personalizados de un tipo especificado que se aplican a un módulo concreto.Retrieves a collection of custom attributes of a specified type that are applied to a specified module. |
IsDefined(Module, Type) |
Indica si se deben aplicar atributos personalizados de un tipo especificado a un módulo especificado.Indicates whether custom attributes of a specified type are applied to a specified module. |
GetModuleVersionId(Module) | |
HasModuleVersionId(Module) |