Hi JB,

I am adding a bunch of new functions to existing classes. Because I am
porting from System.Emit I can compare both APIs.

I am adding local variables to the new function with:

VariableDefinition loc0 = new VariableDefinition("loc0",
ModuleDefinition.Import(typeof(System.Reflection.FieldInfo[])));
md.Body.Variables.Add(loc0);

If I now create a usage of the variable with (OpCodes.Stloc, loc0) I
always get a OpCodes.Stloc, with Emit I get a OpCodes.Stloc.0 or a
OpCodes.Stloc.1 for the first and second defined variable.
With Cecil it looks for me I have to do this by hand, where I have to
be sure that the ordering of the variables is stable
(OpCodes.Stloc_0). How can I be sure that I am refering to the right
slot, or is there a way to do it like with Emit?

Thanks

Jan

-- 
--
mono-cecil

Subscription settings: http://groups.google.com/group/mono-cecil/subscribe?hl=en

Reply via email to