Module.ResolveMember Module.ResolveMember Module.ResolveMember Module.ResolveMember Method

定义

返回由元数据令牌标识的类型或成员。Returns the type or member identified by a metadata token.

重载

ResolveMember(Int32) ResolveMember(Int32) ResolveMember(Int32) ResolveMember(Int32)

返回由指定的元数据令牌标识的类型或成员。Returns the type or member identified by the specified metadata token.

ResolveMember(Int32, Type[], Type[]) ResolveMember(Int32, Type[], Type[]) ResolveMember(Int32, Type[], Type[]) ResolveMember(Int32, Type[], Type[])

在由指定的泛型类型参数定义的上下文中,返回由指定的元数据令牌标识的类型或成员。Returns the type or member identified by the specified metadata token, in the context defined by the specified generic type parameters.

ResolveMember(Int32) ResolveMember(Int32) ResolveMember(Int32) ResolveMember(Int32)

返回由指定的元数据令牌标识的类型或成员。Returns the type or member identified by the specified metadata token.

public:
 System::Reflection::MemberInfo ^ ResolveMember(int metadataToken);
public System.Reflection.MemberInfo ResolveMember (int metadataToken);
member this.ResolveMember : int -> System.Reflection.MemberInfo
Public Function ResolveMember (metadataToken As Integer) As MemberInfo

参数

metadataToken
Int32 Int32 Int32 Int32

一个元数据令牌,用于标识模块中的类型或成员。A metadata token that identifies a type or member in the module.

返回

一个 MemberInfo 对象,表示由指定的元数据令牌标识的类型或成员。A MemberInfo object representing the type or member that is identified by the specified metadata token.

异常

metadataToken 不是当前模块范围内的类型或成员的令牌。metadataToken is not a token for a type or member in the scope of the current module.

-or- metadataToken 是一个 MethodSpecTypeSpec,其签名包含元素类型 var(泛型类型的类型参数)或 mvar(泛型方法的类型参数)。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).

-or- metadataToken 标识一个属性或事件。metadataToken identifies a property or event.

metadataToken 不是当前模块范围内的有效令牌。metadataToken is not a valid token in the scope of the current module.

注解

若要解析的元数据标记MethodSpecTypeSpec其签名包含元素ResolveMember(Int32, Type[], Type[])类型ELEMENT_TYPE_VARELEMENT_TYPE_MVAR的元数据标记,请使用方法重载,这允许你提供必要的上下文。To resolve a metadata token for a MethodSpec or TypeSpec whose signature contains element type ELEMENT_TYPE_VAR or ELEMENT_TYPE_MVAR, use the ResolveMember(Int32, Type[], Type[]) method overload, which allows you to supply the necessary context. 也就是说,当你为依赖于泛型类型的泛型类型参数和/或嵌入了标记的泛型方法的成员的元数据标记进行解析时,必须使用允许提供这些类型参数的重载。That is, when you are resolving a metadata token for a member that depends on the generic type parameters of the generic type and/or the generic method in which the token is embedded, you must use the overload that allows you to supply those type parameters.

备注

有关元数据令牌的信息,请参阅公共语言基础结构(CLI)文档,尤其是 "第二部分:元数据定义和语义 "。Information about metadata tokens can be found in the Common Language Infrastructure (CLI) documentation, especially "Partition II: Metadata Definition and Semantics". 文档在线提供;请参阅在 ECMA 网站上的 MSDN 和标准 ecma-335-公共语言基础结构(CLI)上的ECMA C#和公共语言基础结构标准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.

有关使用一般上下文(即,泛型类型的泛型类型参数和/或泛型方法的泛型类型参数,其中嵌入了标记)的代码,请参阅ResolveMethod(Int32, Type[], Type[])方法。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 ResolveMethod(Int32, Type[], Type[]) method.

ResolveMember(Int32, Type[], Type[]) ResolveMember(Int32, Type[], Type[]) ResolveMember(Int32, Type[], Type[]) ResolveMember(Int32, Type[], Type[])

在由指定的泛型类型参数定义的上下文中,返回由指定的元数据令牌标识的类型或成员。Returns the type or member identified by the specified metadata token, in the context defined by the specified generic type parameters.

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

参数

metadataToken
Int32 Int32 Int32 Int32

一个元数据令牌,用于标识模块中的类型或成员。A metadata token that identifies a type or member in the module.

genericTypeArguments
Type[]

一个 Type 对象的数组,表示以下类型的泛型类型参数,在该类型中,令牌在范围内;如果该类型不是泛型类型,则为 nullAn 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[]

一个 Type 对象的数组,表示以下方法的泛型类型参数,在该方法中,令牌在范围内;如果该方法不是泛型方法,则为 nullAn 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.

返回

一个 MemberInfo 对象,表示由指定的元数据令牌标识的类型或成员。A MemberInfo object representing the type or member that is identified by the specified metadata token.

异常

metadataToken 不是当前模块范围内的类型或成员的令牌。metadataToken is not a token for a type or member in the scope of the current module.

-or- metadataToken 是一个 MethodSpecTypeSpec,其签名包含元素类型 var(泛型类型的类型参数)或 mvar(泛型方法的类型参数),并且没有为 genericTypeArguments 和(或)genericMethodArguments 提供必要的泛型类型参数。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.

-or- metadataToken 标识一个属性或事件。metadataToken identifies a property or event.

metadataToken 不是当前模块范围内的有效令牌。metadataToken is not a valid token in the scope of the current module.

注解

在类型中对类型使用metadataToken genericTypeArguments方法,其中在范围内可获取的泛型类型参数的数组。 Type.GetGenericArgumentsUse the Type.GetGenericArguments method on the type where metadataToken is in scope to obtain an array of generic type arguments for genericTypeArguments. 对方法使用metadataToken genericTypeArguments方法,其中在范围内可获取的泛型类型参数的数组。 MethodInfo.GetGenericArgumentsUse the MethodInfo.GetGenericArguments method on the method where metadataToken is in scope to obtain an array of generic type arguments for genericTypeArguments. 提供这些参数始终是安全的,即使不需要它们也是如此。It is always safe to provide these arguments, even when they are not needed.

备注

有关元数据令牌的信息,请参阅公共语言基础结构(CLI)文档,尤其是 "第二部分:元数据定义和语义 "。Information about metadata tokens can be found in the Common Language Infrastructure (CLI) documentation, especially "Partition II: Metadata Definition and Semantics". 文档在线提供;请参阅在 ECMA 网站上的 MSDN 和标准 ecma-335-公共语言基础结构(CLI)上的ECMA C#和公共语言基础结构标准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.

有关使用一般上下文(即,泛型类型的泛型类型参数和/或泛型方法的泛型类型参数,其中嵌入了标记)的代码,请参阅ResolveMethod(Int32, Type[], Type[])方法。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 ResolveMethod(Int32, Type[], Type[]) method.

适用于