本文整理汇总了C#中MetadataReader.GetMemberReference方法的典型用法代码示例。如果您正苦于以下问题:C# MetadataReader.GetMemberReference方法的具体用法?C# MetadataReader.GetMemberReference怎么用?C# MetadataReader.GetMemberReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetadataReader
的用法示例。
在下文中一共展示了MetadataReader.GetMemberReference方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMemberRef
private static string GetMemberRef(MetadataReader metadataReader, int token, CilTypeProvider provider, string genericParameterSignature = "")
{
var refHandle = MetadataTokens.MemberReferenceHandle(token);
var reference = metadataReader.GetMemberReference(refHandle);
var parentToken = MetadataTokens.GetToken(reference.Parent);
string type;
if (IsTypeSpecification(parentToken))
{
var typeSpecificationHandle = MetadataTokens.TypeSpecificationHandle(parentToken);
var typeSpecification = metadataReader.GetTypeSpecification(typeSpecificationHandle);
type = SignatureDecoder.DecodeType(typeSpecificationHandle, provider, null).ToString();
}
else
{
var parentHandle = MetadataTokens.TypeReferenceHandle(parentToken);
type = SignatureDecoder.DecodeType(parentHandle, provider, null).ToString(false);
}
string signatureValue;
string parameters = string.Empty;
if (reference.GetKind() == MemberReferenceKind.Method)
{
MethodSignature<CilType> signature = SignatureDecoder.DecodeMethodSignature(reference.Signature, provider);
signatureValue = GetMethodReturnType(signature);
parameters = provider.GetParameterList(signature);
return String.Format("{0} {1}::{2}{3}{4}", signatureValue, type, GetString(metadataReader, reference.Name), genericParameterSignature,parameters);
}
signatureValue = SignatureDecoder.DecodeFieldSignature(reference.Signature, provider).ToString();
return String.Format("{0} {1}::{2}{3}", signatureValue, type, GetString(metadataReader, reference.Name), parameters);
}