CK.Reflection.ILGeneratorExtension.LdArg C# (CSharp) Method

LdArg() public static method

Emits the IL to push (OpCodes.Ldarg) the actual argument at the given index onto the stack.
public static LdArg ( this g, int i ) : void
g this This object.
i int Parameter index (0 being the 'this' for instance method).
return void
        public static void LdArg( this ILGenerator g, int i )
        {
            if( i == 0 ) g.Emit( OpCodes.Ldarg_0 );
            else if( i == 1 ) g.Emit( OpCodes.Ldarg_1 );
            else if( i == 2 ) g.Emit( OpCodes.Ldarg_2 );
            else if( i == 3 ) g.Emit( OpCodes.Ldarg_3 );
            else if( i < 255 ) g.Emit( OpCodes.Ldarg_S, (byte)i );
            else g.Emit( OpCodes.Ldarg, (short)i );
        }