Hey, On 1/13/10, Koush <[email protected]> wrote: > public Thing MyMethod > { > Cat cat = new Cat(); > Dog dog = new Dog(); > return new Thing(); > } > > How would I get the list of classes that this method body uses? Ie... > Cat, Dog, and Thing.
Just iterate over the instructions in the body of MyMethod. Switch on the opcode of the instruction, if its OperandType is InlineType, the operand of the Instruction will be a TypeReference. A InlineToken operand may also be a TypeReference (but it can be a FieldReference or a MethodReference as well). -- Jb Evain <[email protected]>
-- -- mono-cecil
