public override void Load()
 {
     if (Type == typeof(int))
     {
         EmitInteger((int)Value);
     }
     else if (Type == typeof(bool))
     {
         var boolean = (bool)Value;
         if (boolean)
         {
             Generator_.Emit(OpCodes.Ldc_I4_1);
         }
         else
         {
             Generator_.Emit(OpCodes.Ldc_I4_0);
         }
     }
     else if (Type == typeof(string))
     {
         Generator_.Emit(OpCodes.Ldstr, (string)Value);
     }
     else
     if (Builder == null)
     {
         Generator_.Emit(OpCodes.Ldnull);
     }
     else
     {
         Generator_.Emit(OpCodes.Newobj, Builder);
     }
 }
Beispiel #2
0
        public override void Load()
        {
            switch (Number)
            {
            case 0:
                Generator_.Emit(OpCodes.Ldarg_0);
                break;

            case 1:
                Generator_.Emit(OpCodes.Ldarg_1);
                break;

            case 2:
                Generator_.Emit(OpCodes.Ldarg_2);
                break;

            case 3:
                Generator_.Emit(OpCodes.Ldarg_3);
                break;

            default:
                if (Number < 256)
                {
                    Generator_.Emit(OpCodes.Ldarg_S, Number);
                }
                else
                {
                    Generator_.Emit(OpCodes.Ldarg, Number);
                }
                break;
            }
        }
 public override void Load()
 {
     if (!FieldInfo.IsStatic)
     {
         Generator_.Emit(OpCodes.Ldarg_0);
         Generator_.Emit(OpCodes.Ldfld, FieldInfo);
     }
     else
     {
         Generator_.Emit(OpCodes.Ldsfld, FieldInfo);
     }
 }