MemberInfo.MetadataToken 属性

定义

获取一个值,该值标识元数据元素。Gets a value that identifies a metadata element.

public:
 virtual property int MetadataToken { int get(); };
public virtual int MetadataToken { get; }
member this.MetadataToken : int
Public Overridable ReadOnly Property MetadataToken As Integer

属性值

结合 Module,该值能够唯一标识元数据元素。A value which, in combination with Module, uniquely identifies a metadata element.

异常

当前 MemberInfo 表示数组方法(如 Address),针对元素类型是尚未完成的动态类型的数组类型。The current MemberInfo represents an array method, such as Address, on an array type whose element type is a dynamic type that has not been completed. 若要在这种情况下获取元数据标记,将 MemberInfo 对象传递给 GetMethodToken(MethodInfo) 方法;或使用 GetArrayMethodToken(Type, String, CallingConventions, Type, Type[]) 方法直接获取标记,而不是首先使用 GetArrayMethod(Type, String, CallingConventions, Type, Type[]) 方法获取 MethodInfoTo get a metadata token in this case, pass the MemberInfo object to the GetMethodToken(MethodInfo) method; or use the GetArrayMethodToken(Type, String, CallingConventions, Type, Type[]) method to get the token directly, instead of using the GetArrayMethod(Type, String, CallingConventions, Type, Type[]) method to get a MethodInfo first.

注解

使用此属性获取的令牌可传递给非托管反射 API。The tokens obtained using this property can be passed to the unmanaged reflection API. 有关详细信息,请参阅非托管反射 APIFor more information, please see Unmanaged Reflection API.

备注

使用非托管反射 API 需要熟悉公共语言基础结构(CLI)文档,尤其是 "第二部分:Metadata Definition and Semantics”(第 2 部分:元数据定义和语义)和“Partition III:CIL Instruction Set”(第 3 部分:CIL 指令集)。Using the unmanaged reflection API requires familiarity with the Common Language Infrastructure (CLI) documentation, especially "Partition II: Metadata Definition and Semantics" and "Partition III: CIL Instruction Set". 可联机获取该文档;请参阅 MSDN 上的 ECMA C# 和公共语言基础结构标准和 Ecma International 网站上的标准 ECMA-335 - 公共语言基础结构 (CLI)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 International Web site.

适用于