Hey,

On Fri, Nov 7, 2014 at 12:20 AM, BlackSky Blacksky
<[email protected]> wrote:
>             if (MethodDefRetType != null)
>             {
>                 MethodDefinition NewMethod = new
> MethodDefinition(RandomName(), MethodAttributes.Static, MethodDefRetType);
>                 if (Params.Length > 0)
>                 {
>                     for (int i = 1; i < MethodRef.Parameters.Count; i++)

Why don't you start at 0?

Parameters will have all the «logical parameters» of a method. Which
means all the parameters for a static methods, and all parameters
after this for an instance method.


>                     {
>                         ParameterDefinition parameter = new
> ParameterDefinition(MethodRef.Parameters[i].ParameterType);
>                         NewMethod.Parameters.Add(parameter);
>
> NewMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Ldarg,
> parameter));
>                         i++;

Why do you increment once more? Your for loop does it.

>                     }
>                 }

Jb

-- 
-- 
--
mono-cecil
--- 
You received this message because you are subscribed to the Google Groups 
"mono-cecil" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to