Module Classe
Definição
Executa a reflexão em um 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
- Herança
-
Module
- Derivado
- Atributos
- Implementações
Exemplos
Os exemplos de código a seguir mostram como usar a reflexão para obter informações sobre 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
Comentários
Um módulo é um arquivo executável portátil, como type.dll ou application.exe, consistindo em uma ou mais classes e interfaces.A module is a portable executable file, such as type.dll or application.exe, consisting of one or more classes and interfaces. Pode haver vários namespaces contidas em um único módulo e um namespace pode abranger vários módulos.There may be multiple namespaces contained in a single module, and a namespace may span multiple modules.
Um ou vários módulos implantados como uma unidade compõem um assembly.One or more modules deployed as a unit compose an assembly. Para obter informações sobre como criar um assembly com mais de um módulo, consulte assemblies de multiarquivos.For information about creating an assembly with more than one module, see Multifile Assemblies.
Observe que um módulo .NET Framework não é o mesmo que um módulo no Visual Basic, que é usado por um programadores para organizar funções e sub-rotinas em um aplicativo.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.
Construtores
| Module() |
Inicializa uma nova instância da classe Module.Initializes a new instance of the Module class. |
Campos
| FilterTypeName |
Um objeto |
| FilterTypeNameIgnoreCase |
Um objeto |
Propriedades
| Assembly |
Obtém o Assembly apropriado para essa instância do Module.Gets the appropriate Assembly for this instance of Module. |
| CustomAttributes |
Obtém uma coleção que contém os atributos personalizados deste módulo.Gets a collection that contains this module's custom attributes. |
| FullyQualifiedName |
Obtém uma cadeia de caracteres que representa o nome totalmente qualificado e o caminho para esse módulo.Gets a string representing the fully qualified name and path to this module. |
| MDStreamVersion |
Obtém a versão de fluxo de metadados.Gets the metadata stream version. |
| MetadataToken |
Obtém um token que identifica o módulo nos metadados.Gets a token that identifies the module in metadata. |
| ModuleHandle |
Obtém um identificador para o módulo.Gets a handle for the module. |
| ModuleVersionId |
Obtém um UUID (identificador universal exclusivo) que pode ser usado para distinguir entre duas versões de um módulo.Gets a universally unique identifier (UUID) that can be used to distinguish between two versions of a module. |
| Name |
Obtém um |
| ScopeName |
Obtém uma cadeia de caracteres que representa o nome do módulo.Gets a string representing the name of the module. |
Métodos
| Equals(Object) |
Determina se este módulo e o objeto especificado são iguais.Determines whether this module and the specified object are equal. |
| Equals(Object) |
Determina se o objeto especificado é igual ao objeto atual.Determines whether the specified object is equal to the current object. (Herdado de Object) |
| FindTypes(TypeFilter, Object) |
Retorna uma matriz de classes aceitas pelo filtro e critérios de filtro determinados.Returns an array of classes accepted by the given filter and filter criteria. |
| GetCustomAttributes(Boolean) |
Retorna todos os atributos personalizados.Returns all custom attributes. |
| GetCustomAttributes(Type, Boolean) |
Obtém os atributos personalizados do tipo especificado.Gets custom attributes of the specified type. |
| GetCustomAttributesData() |
Retorna uma lista de objetos CustomAttributeData para o módulo atual, que pode ser usado no contexto somente para reflexão.Returns a list of CustomAttributeData objects for the current module, which can be used in the reflection-only context. |
| GetField(String) |
Retorna um campo que tem o nome especificado.Returns a field having the specified name. |
| GetField(String, BindingFlags) |
Retorna um campo com o nome e os atributos de associação especificados.Returns a field having the specified name and binding attributes. |
| GetFields() |
Retorna os campos globais definidos no módulo.Returns the global fields defined on the module. |
| GetFields(BindingFlags) |
Retorna os campos globais definidos no módulo que correspondem aos sinalizadores de associação especificados.Returns the global fields defined on the module that match the specified binding flags. |
| GetHashCode() |
Retorna o código hash para a instância.Returns the hash code for this instance. |
| GetHashCode() |
Serve como a função de hash padrão.Serves as the default hash function. (Herdado de Object) |
| GetMethod(String) |
Retorna um método com o nome especificado.Returns a method having the specified name. |
| GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) |
Retorna um método contendo o nome especificado, informações de associação, convenção de chamada e tipos de parâmetro e modificadores.Returns a method having the specified name, binding information, calling convention, and parameter types and modifiers. |
| GetMethod(String, Type[]) |
Retorna um método com os tipos de parâmetro e nome especificados.Returns a method having the specified name and parameter types. |
| GetMethodImpl(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) |
Retorna a implementação do método de acordo com os critérios especificados.Returns the method implementation in accordance with the specified criteria. |
| GetMethods() |
Retorna os métodos globais definidos no módulo.Returns the global methods defined on the module. |
| GetMethods(BindingFlags) |
Retorna os métodos globais definidos no módulo que correspondem aos sinalizadores de associação especificados.Returns the global methods defined on the module that match the specified binding flags. |
| GetObjectData(SerializationInfo, StreamingContext) |
Fornece uma implementação ISerializable para objetos serializados.Provides an ISerializable implementation for serialized objects. |
| GetPEKind(PortableExecutableKinds, ImageFileMachine) |
Obtém um par de valores que indica a natureza do código em um módulo e a plataforma de destino do módulo.Gets a pair of values indicating the nature of the code in a module and the platform targeted by the module. |
| GetSignerCertificate() |
Retorna um objeto |
| GetType() |
Obtém o Type da instância atual.Gets the Type of the current instance. (Herdado de Object) |
| GetType(String) |
Retorna o tipo especificado, executando uma pesquisa que diferencia maiúsculas de minúsculas.Returns the specified type, performing a case-sensitive search. |
| GetType(String, Boolean) |
Retorna o tipo especificado, pesquisando o módulo com a diferenciação de maiúsculas e minúsculas especificada.Returns the specified type, searching the module with the specified case sensitivity. |
| GetType(String, Boolean, Boolean) |
Retorna o tipo especificado, especificando se deve ser feita uma pesquisa que diferencia maiúsculas de minúsculas do módulo e gerar uma exceção se não for possível localizar o 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() |
Retorna todos os tipos definidos nesse módulo.Returns all the types defined within this module. |
| IsDefined(Type, Boolean) |
Retorna um valor que indica se o tipo de atributo especificado foi aplicado a este módulo.Returns a value that indicates whether the specified attribute type has been applied to this module. |
| IsResource() |
Obtém um valor que indica se o objeto é um recurso.Gets a value indicating whether the object is a resource. |
| MemberwiseClone() |
Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object. (Herdado de Object) |
| ResolveField(Int32) |
Retorna o campo identificado pelo token de metadados especificado.Returns the field identified by the specified metadata token. |
| ResolveField(Int32, Type[], Type[]) |
Retorna o campo identificado pelo token de metadados especificado, no contexto definido pelos 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) |
Retorna o tipo ou o membro identificado pelo token de metadados especificado.Returns the type or member identified by the specified metadata token. |
| ResolveMember(Int32, Type[], Type[]) |
Retorna o tipo ou o membro identificado pelo token de metadados especificado, no contexto definido pelos 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) |
Retorna o método ou o construtor identificado pelo token de metadados especificado.Returns the method or constructor identified by the specified metadata token. |
| ResolveMethod(Int32, Type[], Type[]) |
Retorna o método ou o construtor identificado pelo token de metadados especificado, no contexto definido pelos 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) |
Retorna o blob de assinatura identificado por um token de metadados.Returns the signature blob identified by a metadata token. |
| ResolveString(Int32) |
Retorna a cadeia de caracteres identificada pelo token de metadados especificado.Returns the string identified by the specified metadata token. |
| ResolveType(Int32) |
Retorna o tipo identificado pelo token de metadados especificado.Returns the type identified by the specified metadata token. |
| ResolveType(Int32, Type[], Type[]) |
Retorna o tipo identificado pelo token de metadados especificado no contexto definido pelos 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() |
Retorna o nome do módulo.Returns the name of the module. |
Operadores
| Equality(Module, Module) |
Indica se dois objetos Module são iguais.Indicates whether two Module objects are equal. |
| Inequality(Module, Module) |
Indica se dois objetos Module não são iguais.Indicates whether two Module objects are not equal. |
Implantações explícitas de interface
| _Module.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
Mapeia um conjunto de nomes para um conjunto correspondente de identificadores de expedição.Maps a set of names to a corresponding set of dispatch identifiers. |
| _Module.GetTypeInfo(UInt32, UInt32, IntPtr) |
Recupera as informações do tipo de um objeto, que podem ser usadas para obter informações de tipo para uma interface.Retrieves the type information for an object, which can then be used to get the type information for an interface. |
| _Module.GetTypeInfoCount(UInt32) |
Retorna o número de interfaces de informações do tipo que um objeto fornece (0 ou 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) |
Fornece acesso a propriedades e métodos expostos por um objeto.Provides access to properties and methods exposed by an object. |
| ICustomAttributeProvider.GetCustomAttributes(Boolean) |
Retorna uma matriz de todos os atributos personalizados definidos neste membro, exceto atributos nomeados ou então uma matriz vazia, se não houver nenhum atributo personalizado.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) |
Retorna uma matriz de atributos personalizados definidos neste membro, identificados por tipo ou então uma matriz vazia, se não houver nenhum atributo personalizado desse 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 se uma ou mais instâncias de |
Métodos de Extensão
| GetCustomAttribute(Module, Type) |
Recupera um atributo personalizado de um tipo especificado aplicado a um módulo especificado.Retrieves a custom attribute of a specified type that is applied to a specified module. |
| GetCustomAttribute<T>(Module) |
Recupera um atributo personalizado de um tipo especificado aplicado a um módulo especificado.Retrieves a custom attribute of a specified type that is applied to a specified module. |
| GetCustomAttributes(Module) |
Recupera uma coleção de atributos personalizados que são aplicados a um módulo especificado.Retrieves a collection of custom attributes that are applied to a specified module. |
| GetCustomAttributes(Module, Type) |
Recupera uma coleção de atributos personalizados de um tipo especificado que são aplicados a um módulo especificado.Retrieves a collection of custom attributes of a specified type that are applied to a specified module. |
| GetCustomAttributes<T>(Module) |
Recupera uma coleção de atributos personalizados de um tipo especificado que são aplicados a um módulo especificado.Retrieves a collection of custom attributes of a specified type that are applied to a specified module. |
| IsDefined(Module, Type) |
Indica se os atributos personalizados de um tipo especificados são aplicados a um módulo especificado.Indicates whether custom attributes of a specified type are applied to a specified module. |
| GetModuleVersionId(Module) | |
| HasModuleVersionId(Module) | |