本文整理汇总了C#中IModule.ResolveType方法的典型用法代码示例。如果您正苦于以下问题:C# IModule.ResolveType方法的具体用法?C# IModule.ResolveType怎么用?C# IModule.ResolveType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IModule
的用法示例。
在下文中一共展示了IModule.ResolveType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SystemTypes
public SystemTypes(IModule module)
{
this.System_Object = module.ResolveType("System.Object", null);
this.System_Enum = module.ResolveType("System.Enum", null);
this.System_MulticastDelegate = module.ResolveType("System.MulticastDelegate", null);
this.System_Delegate = module.ResolveType("System.Delegate", null);
this.System_ValueType = module.ResolveType("System.ValueType", null);
this.System_Void = module.ResolveType("System.Void", null);
this.System_Boolean = module.ResolveType("System.Boolean", null);
this.System_Char = module.ResolveType("System.Char", null);
this.System_SByte = module.ResolveType("System.SByte", null);
this.System_Byte = module.ResolveType("System.Byte", null);
this.System_Int16 = module.ResolveType("System.Int16", null);
this.System_UInt16 = module.ResolveType("System.UInt16", null);
this.System_Int32 = module.ResolveType("System.Int32", null);
this.System_UInt32 = module.ResolveType("System.UInt32", null);
this.System_Int64 = module.ResolveType("System.Int64", null);
this.System_UInt64 = module.ResolveType("System.UInt64", null);
this.System_Decimal = module.ResolveType("System.Decimal", null);
this.System_Single = module.ResolveType("System.Single", null);
this.System_Double = module.ResolveType("System.Double", null);
this.System_String = module.ResolveType("System.String", null);
this.System_IntPtr = module.ResolveType("System.IntPtr", null);
this.System_UIntPtr = module.ResolveType("System.UIntPtr", null);
this.System_Array = module.ResolveType("System.Array", null);
this.System_Collections_IEnumerable = module.ResolveType("System.Collections.IEnumerable", null);
this.System_Collections_Generic_IEnumerable_T = module.ResolveType("System.Collections.Generic.IEnumerable`1", null);
this.System_Collections_Generic_IList_T = module.ResolveType("System.Collections.Generic.IList`1", null);
this.System_Collections_Generic_ICollection_T = module.ResolveType("System.Collections.Generic.ICollection`1", null);
this.System_Collections_IEnumerator = module.ResolveType("System.Collections.IEnumerator", null);
this.System_Collections_Generic_IEnumerator_T = module.ResolveType("System.Collections.Generic.IEnumerator`1", null);
this.System_Collections_Generic_IReadOnlyList_T = module.ResolveType("System.Collections.Generic.IReadOnlyList`1", null);
this.System_Collections_Generic_IReadOnlyCollection_T = module.ResolveType("System.Collections.Generic.IReadOnlyCollection`1", null);
this.System_Nullable_T = module.ResolveType("System.Nullable`1", null);
this.System_DateTime = module.ResolveType("System.DateTime", null);
this.System_IDisposable = module.ResolveType("System.IDisposable", null);
this.System_TypedReference = module.ResolveType("System.TypedReference", null);
////this.System_ArgIterator = module.ResolveType("System.ArgIterator", null);
this.System_RuntimeArgumentHandle = module.ResolveType("System.RuntimeArgumentHandle", null);
this.System_RuntimeFieldHandle = module.ResolveType("System.RuntimeFieldHandle", null);
this.System_RuntimeMethodHandle = module.ResolveType("System.RuntimeMethodHandle", null);
this.System_RuntimeTypeHandle = module.ResolveType("System.RuntimeTypeHandle", null);
this.System_IAsyncResult = module.ResolveType("System.IAsyncResult", null);
this.System_AsyncCallback = module.ResolveType("System.AsyncCallback", null);
this.System_ArraySegment_T1 = module.ResolveType("System.ArraySegment`1", null);
this.System_Exception = module.ResolveType("System.Exception", null);
this.System_NotSupportedException = module.ResolveType("System.NotSupportedException", null);
this.System_Type = module.ResolveType("System.Type", null);
this.System_RuntimeType = module.ResolveType("System.RuntimeType", null);
}
示例2: OpCodes
//.........这里部分代码省略.........
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:
case Code.Stelem:
case Code.Ldelema:
case Code.Box:
case Code.Unbox:
case Code.Unbox_Any:
case Code.Castclass:
case Code.Initobj:
case Code.Isinst:
case Code.Ldobj:
case Code.Stobj:
case Code.Constrained:
case Code.Sizeof:
case Code.Mkrefany:
case Code.Refanyval:
// read token, next
token = ReadInt32(enumerator, ref currentAddress);
var type = module.ResolveType(token, genericContext);
this.AddGenericSpecializedType(type);
if (code == Code.Box)
{
this.AddStructType(type);
}
this.AddUsedType(type);
yield return new OpCodeTypePart(opCode, startAddress, currentAddress, type);
continue;
case Code.Switch:
var ints = new List<int>();
var count = ReadInt32(enumerator, ref currentAddress);
for (var i = 0; i < count; i++)
{
ints.Add(ReadInt32(enumerator, ref currentAddress));
}
yield return new OpCodeLabelsPart(opCode, startAddress, currentAddress, ints.ToArray());
continue;
default:
yield return new OpCodePart(opCode, startAddress, currentAddress);
continue;
}
}
}