public IEnumerable <IRewriteTarget> GetTargets(MethodBase method, object target)
        {
            DisassembleResult disassembleResult = _methodDisassembler.Disassemble(method);

            List <MethodDefinition> setupMethods = _setupMethods.Select(setupMethod =>
                                                                        disassembleResult.ModuleDefinition.Import(setupMethod).Resolve()).ToList();

            return(GetSetupsFromInstructions(target, disassembleResult.Body, setupMethods));
        }
        private IEnumerable <Tuple <MethodBase, object> > FindEventAddRemoveAccessors(Action action)
        {
            DisassembleResult disassembleResult = _methodDisassembler.Disassemble(action.Method);

            foreach (Instruction instruction in disassembleResult.Body.Instructions)
            {
                MethodReference calledMethod;
                if (_instructionHelper.TryGetCall(instruction, out calledMethod))
                {
                    if (IsEventAddRemoveMethod(calledMethod))
                    {
                        object target = calledMethod.HasThis
                            ? GetInvocationTarget(disassembleResult.Body, instruction, action.Target)
                            : null;

                        MethodBase method = _methodResolver.Resolve(calledMethod);

                        yield return(Tuple.Create(method, target));
                    }
                }
            }
        }