this is the method we want to process, all it needs from its arguments is that eventArgs so it can get row and column of the spread from it
private void sshResults_ButtonClicked(object eventSender, EditorNotifyEventArgs eventArgs)
but the consumer is calling it like this:
this.sshResults_ButtonClicked(null, new EditorNotifyEventArgs(new SpreadView(), null, Row - 1,Column - 1));
I don’t want to call it that way, it is too much resources just to pass a row and column .
What is a good way to rewrite this? Maybe I can create another method, copy paste the whole body of the first method in it and just pass row and column to it? then it causes code redundancy? There are like 500 places we are using sshResults_ButtonClicked but I just want to change the one mentioned above, so I don’t want to get rid of sshResults_ButtonClicked either.
Refactor the appropriate part of
sshResults_ButtonClickedto its own method and call that instead from both the event handler and where you want to call it explicitly.