本文整理汇总了C#中TypeDef.ToTypeSig方法的典型用法代码示例。如果您正苦于以下问题:C# TypeDef.ToTypeSig方法的具体用法?C# TypeDef.ToTypeSig怎么用?C# TypeDef.ToTypeSig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeDef
的用法示例。
在下文中一共展示了TypeDef.ToTypeSig方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResolveGenericArgument
private static VTable ResolveGenericArgument(TypeDef openType, GenericInstSig genInst, VTable vTable)
{
Debug.Assert(openType == vTable.Type);
var ret = new VTable(openType);
ret.GenericArguments = genInst.GenericArguments;
foreach (VTableSlot slot in vTable.Slots) {
MethodSig newSig = GenericArgumentResolver.Resolve(slot.Signature.MethodSig, genInst.GenericArguments);
TypeSig newDecl = slot.DeclaringType;
if (new SigComparer().Equals(newDecl, openType))
newDecl = new GenericInstSig((ClassOrValueTypeSig)openType.ToTypeSig(), genInst.GenericArguments.ToArray());
else
newDecl = GenericArgumentResolver.Resolve(newDecl, genInst.GenericArguments);
ret.Slots.Add(new VTableSlot(ret, slot.MethodDef, newDecl, new VTableSignature(genInst, newSig, slot.Signature.Name)).Override(slot));
}
return ret;
}
示例2: CreateField
private FieldDef CreateField(RPContext ctx, TypeDef delegateType)
{
// Details will be filled in during metadata writing
TypeDef randomType;
do {
randomType = ctx.Module.Types[ctx.Random.NextInt32(ctx.Module.Types.Count)];
} while (randomType.HasGenericParameters || randomType.IsGlobalModuleType || randomType.IsDelegate());
TypeSig fieldType = new CModOptSig(randomType, delegateType.ToTypeSig());
var field = new FieldDefUser("", new FieldSig(fieldType), FieldAttributes.Static | FieldAttributes.Assembly);
field.CustomAttributes.Add(new CustomAttribute(GetKeyAttr(ctx).FindInstanceConstructors().First()));
delegateType.Fields.Add(field);
ctx.Marker.Mark(field);
ctx.Name.SetCanRename(field, false);
return field;
}
示例3: BaseTypes
private static IEnumerable<TypeSig> BaseTypes(TypeDef typeDef)
{
if (typeDef == null)
yield break;
if (typeDef.BaseType == null)
yield break;
TypeSig baseType = typeDef.ToTypeSig();
do {
var genericArgs = baseType is GenericInstSig ? ((GenericInstSig)baseType).GenericArguments : null;
baseType = GenericArgumentResolver.Resolve(typeDef.BaseType.ToTypeSig(), genericArgs, null);
yield return baseType;
typeDef = typeDef.BaseType.ResolveTypeDef();
if (typeDef == null)
break;
} while (typeDef.BaseType != null);
}
示例4: BaseTypes
private static IEnumerable<TypeSig> BaseTypes(TypeDef type)
{
return BaseTypes(type.ToTypeSig());
}