本文整理汇总了C#中dnlib.DotNet.TypeSig.RemovePinned方法的典型用法代码示例。如果您正苦于以下问题:C# TypeSig.RemovePinned方法的具体用法?C# TypeSig.RemovePinned怎么用?C# TypeSig.RemovePinned使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dnlib.DotNet.TypeSig
的用法示例。
在下文中一共展示了TypeSig.RemovePinned方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddPushDefaultValue
void AddPushDefaultValue(int count, ref int index, TypeSig pushType)
{
pushType = pushType.RemovePinned();
switch (count > 10 ? ElementType.End : pushType.RemovePinnedAndModifiers().GetElementType()) {
case ElementType.Void:
break;
case ElementType.Boolean:
case ElementType.Char:
case ElementType.I1:
case ElementType.U1:
case ElementType.I2:
case ElementType.U2:
case ElementType.I4:
case ElementType.U4:
InstructionsListVM.Insert(index++, CreateInstructionVM(Code.Ldc_I4_0));
break;
case ElementType.I8:
case ElementType.U8:
InstructionsListVM.Insert(index++, CreateInstructionVM(Code.Ldc_I4_0));
InstructionsListVM.Insert(index++, CreateInstructionVM(Code.Conv_I8));
break;
case ElementType.R4:
InstructionsListVM.Insert(index++, CreateInstructionVM(Code.Ldc_R4));
break;
case ElementType.R8:
InstructionsListVM.Insert(index++, CreateInstructionVM(Code.Ldc_R8));
break;
case ElementType.I:
InstructionsListVM.Insert(index++, CreateInstructionVM(Code.Ldc_I4_0));
InstructionsListVM.Insert(index++, CreateInstructionVM(Code.Conv_I));
break;
case ElementType.U:
case ElementType.Ptr:
case ElementType.FnPtr:
InstructionsListVM.Insert(index++, CreateInstructionVM(Code.Ldc_I4_0));
InstructionsListVM.Insert(index++, CreateInstructionVM(Code.Conv_U));
break;
case ElementType.ValueType:
var td = ((ValueTypeSig)pushType).TypeDefOrRef.ResolveTypeDef();
if (td != null && td.IsEnum) {
var undType = td.GetEnumUnderlyingType().RemovePinnedAndModifiers();
var et = undType.GetElementType();
if ((ElementType.Boolean <= et && et <= ElementType.R8) || et == ElementType.I || et == ElementType.U) {
AddPushDefaultValue(count + 1, ref index, undType);
break;
}
}
goto case ElementType.TypedByRef;
case ElementType.TypedByRef:
case ElementType.Var:
case ElementType.MVar:
var local = new LocalVM(typeSigCreatorOptions, new LocalOptions(new Local(pushType)));
this.LocalsListVM.Add(local);
var newInstr = CreateInstructionVM(Code.Ldloca);
newInstr.InstructionOperandVM.OperandListItem = local;
InstructionsListVM.Insert(index++, newInstr);
newInstr = CreateInstructionVM(Code.Initobj);
newInstr.InstructionOperandVM.Other = local.Type.ToTypeDefOrRef();
InstructionsListVM.Insert(index++, newInstr);
newInstr = CreateInstructionVM(Code.Ldloc);
newInstr.InstructionOperandVM.OperandListItem = local;
InstructionsListVM.Insert(index++, newInstr);
break;
case ElementType.GenericInst:
if (((GenericInstSig)pushType).GenericType is ValueTypeSig)
goto case ElementType.TypedByRef;
goto case ElementType.Class;
case ElementType.End:
case ElementType.String:
case ElementType.ByRef:
case ElementType.Class:
case ElementType.Array:
case ElementType.ValueArray:
case ElementType.R:
case ElementType.Object:
case ElementType.SZArray:
case ElementType.CModReqd:
case ElementType.CModOpt:
case ElementType.Internal:
case ElementType.Module:
case ElementType.Sentinel:
case ElementType.Pinned:
default:
InstructionsListVM.Insert(index++, CreateInstructionVM(Code.Ldnull));
break;
}
}