MemberInfoExtensions.GetMetadataToken(MemberInfo) 方法

定义

获取给定成员的元数据令牌(如果可用)。Gets a metadata token for the given member, if available.

public:
[System::Runtime::CompilerServices::Extension]
 static int GetMetadataToken(System::Reflection::MemberInfo ^ member);
public static int GetMetadataToken (this System.Reflection.MemberInfo member);
static member GetMetadataToken : System.Reflection.MemberInfo -> int
<Extension()>
Public Function GetMetadataToken (member As MemberInfo) As Integer

参数

member
MemberInfo

作为 reftype 检索令牌的成员。The member from which to retrieve the token, as reftype.

返回

一个表示元数据令牌的整数。An integer representing the metadata token. 返回的令牌永不为零。The returned token is never nil. 如果不可用,则引发异常。If unavailable, an exception is thrown.

例外

无可用的元数据令牌。There is no metadata token available.

注解

如果元数据标记不适用于指定的成员, 则此方法将引发异常。This method throws an exception if a metadata token is not available for the specified member. 调用此方法HasMetadataToken前, 可以调用来确定元数据令牌是否可用。You can call HasMetadataToken to determine whether a metadata token is available before calling this method.

适用于