ModuleBuilder.ResolveMember(Int32, Type[], Type[]) Método

Definição

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.

public:
 override System::Reflection::MemberInfo ^ ResolveMember(int metadataToken, cli::array <Type ^> ^ genericTypeArguments, cli::array <Type ^> ^ genericMethodArguments);
public override System.Reflection.MemberInfo? ResolveMember (int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments);
public override System.Reflection.MemberInfo ResolveMember (int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments);
override this.ResolveMember : int * Type[] * Type[] -> System.Reflection.MemberInfo
Public Overrides Function ResolveMember (metadataToken As Integer, genericTypeArguments As Type(), genericMethodArguments As Type()) As MemberInfo

Parâmetros

metadataToken
Int32

Um token de metadados que identifica um tipo ou membro no módulo.A metadata token that identifies a type or member in the module.

genericTypeArguments
Type[]

Uma matriz de objetos Type que representam os argumentos de tipo genérico do tipo em que o token está no escopo ou null se esse tipo não for genérico.An array of Type objects representing the generic type arguments of the type where the token is in scope, or null if that type is not generic.

genericMethodArguments
Type[]

Uma matriz de objetos Type que representam os argumentos de tipo genérico do método em que o token está no escopo ou null se esse método não for genérico.An array of Type objects representing the generic type arguments of the method where the token is in scope, or null if that method is not generic.

Retornos

MemberInfo

Um objeto MemberInfo que representa o tipo ou o membro que é identificado pelo token de metadados especificado.A MemberInfo object representing the type or member that is identified by the specified metadata token.

Exceções

metadataToken não é um token para um tipo ou membro no escopo do módulo atual.metadataToken is not a token for a type or member in the scope of the current module.

- ou --or- metadataToken é um MethodSpec ou TypeSpec cuja assinatura contém o tipo de elemento var (um parâmetro de tipo de um tipo genérico) ou mvar (um parâmetro de tipo de um método genérico) e os argumentos de tipo genérico necessários não foram fornecidos para genericTypeArguments ou genericMethodArguments ou ambos.metadataToken is a MethodSpec or TypeSpec whose signature contains element type var (a type parameter of a generic type) or mvar (a type parameter of a generic method), and the necessary generic type arguments were not supplied for either or both of genericTypeArguments and genericMethodArguments.

- ou --or- metadataToken identifica uma propriedade ou evento.metadataToken identifies a property or event.

metadataToken não é um token válido no escopo do módulo atual.metadataToken is not a valid token in the scope of the current module.

Comentários

Use o Type.GetGenericArguments método no tipo em que metadataToken está no escopo para obter uma matriz de argumentos de tipo genérico genericTypeArguments para.Use the Type.GetGenericArguments method on the type where metadataToken is in scope to obtain an array of generic type arguments for genericTypeArguments. Use o MethodInfo.GetGenericArguments método no método em que metadataToken está no escopo para obter uma matriz de argumentos de tipo genérico genericTypeArguments para.Use the MethodInfo.GetGenericArguments method on the method where metadataToken is in scope to obtain an array of generic type arguments for genericTypeArguments. É sempre seguro fornecer esses argumentos, mesmo quando eles não são necessários.It is always safe to provide these arguments, even when they are not needed.

Observação

Informações sobre tokens de metadados podem ser encontradas na documentação do Common Language Infrastructure (CLI), especialmente "partição II: definição de metadados e semântica".Information about metadata tokens can be found in the Common Language Infrastructure (CLI) documentation, especially "Partition II: Metadata Definition and Semantics". A documentação está disponível online; consulte padrões ECMA C# e Common Language Infrastructure no MSDN e standard ECMA-335-Common Language Infrastructure (CLI) no site da ECMA.The documentation is available online; see ECMA C# and Common Language Infrastructure Standards on MSDN and Standard ECMA-335 - Common Language Infrastructure (CLI) on the ECMA Web site.

Para o código que demonstra a resolução de token usando o contexto genérico (ou seja, os parâmetros de tipo genérico do tipo genérico e/ou o método genérico no qual o token é incorporado), consulte o Module.ResolveMethod(Int32, Type[], Type[]) método.For code that demonstrates token resolution using the generic context (that is, the generic type parameters of the generic type and/or the generic method in which the token is embedded) see the Module.ResolveMethod(Int32, Type[], Type[]) method.

Aplica-se a