MemberInfo.MetadataToken MemberInfo.MetadataToken MemberInfo.MetadataToken MemberInfo.MetadataToken Property

定義

取得值,這個值可識別中繼資料項目。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.

備註

使用這個屬性取得的權杖可以傳遞至 unmanaged 反映 API。The tokens obtained using this property can be passed to the unmanaged reflection API. 如需詳細資訊,請參閱Unmanaged 反映 APIFor more information, please see Unmanaged Reflection API.

注意

使用 unmanaged 的反映 API,尤其是需要熟悉的 Common Language Infrastructure (CLI) 文件中,「 第二部分:Metadata Definition and Semantics" 和 "Partition III:CIL Instruction Set"。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.

適用於