本文整理汇总了C#中IModule.ResolveToken方法的典型用法代码示例。如果您正苦于以下问题:C# IModule.ResolveToken方法的具体用法?C# IModule.ResolveToken怎么用?C# IModule.ResolveToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IModule
的用法示例。
在下文中一共展示了IModule.ResolveToken方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OpCodes
//.........这里部分代码省略.........
this.AddGenericSpecializedType(method.DeclaringType);
this.AddGenericSpecializedMethod(method, stackCall);
this.AddUsedType(method.DeclaringType);
yield return new OpCodeMethodInfoPart(opCode, startAddress, currentAddress, method);
continue;
case Code.Stfld:
case Code.Stsfld:
case Code.Ldfld:
case Code.Ldflda:
case Code.Ldsfld:
case Code.Ldsflda:
// read token, next
token = ReadInt32(enumerator, ref currentAddress);
var field = module.ResolveField(token, genericContext);
this.AddGenericSpecializedType(field.FieldType);
this.AddGenericSpecializedType(field.DeclaringType);
this.AddUsedType(field.DeclaringType);
if (code == Code.Ldsfld || code == Code.Ldsflda)
{
this.AddUsedStaticFieldToRead(field);
}
yield return new OpCodeFieldInfoPart(opCode, startAddress, currentAddress, field);
continue;
case Code.Ldtoken: // can it be anything?
token = ReadInt32(enumerator, ref currentAddress);
var resolvedToken = module.ResolveToken(token, genericContext);
var typeToken = resolvedToken as IType;
if (typeToken != null)
{
this.AddUsedType(typeToken);
yield return new OpCodeTypePart(opCode, startAddress, currentAddress, typeToken);
continue;
}
var fieldMember = resolvedToken as IField;
if (fieldMember != null)
{
this.AddUsedType(fieldMember.DeclaringType);
yield return new OpCodeFieldInfoPart(opCode, startAddress, currentAddress, fieldMember);
continue;
}
var methodMember = resolvedToken as IMethod;
if (methodMember != null)
{
this.AddUsedType(methodMember.DeclaringType);
yield return new OpCodeMethodInfoPart(opCode, startAddress, currentAddress, methodMember);
continue;
}
yield return new OpCodeInt32Part(opCode, startAddress, currentAddress, token);
continue;
case Code.Newarr:
case Code.Ldelem: