I have the following code sample taken from Form code:
protected void SomeMethod() { SomeOtherMethod(this.OnPaint); } private void SomeOtherMethod(Action<PaintEventArgs> onPaint) { onPaint += MyPaint; } protected void MyPaint(PaintEventArgs e) {
The second method ( SomeOtherMethod ) has a reporter complaining about me. He says onPaint that "the assigned value is not used in any execution path."
In my opinion, this was used because I added the method to the list of methods that were called when the paint was done.
But usually when resharper tells me something like this, it is because I don’t understand some part of C #. How is it possible, when a parameter leaves the region leaves the region, the element that I added to the list is deleted (or something like that).
I thought I would ask here to see if anyone knows what the Reshar is trying to tell me.
(Side Note: I usually just override OnPaint, but I try to get OnPaint to call the method in another class. I don’t want to publish this method publicly, so I thought I would go to the OnPaint group and add to it.)
c # resharper
Vaccano
source share