Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all articles
Browse latest Browse all 106942

RSRP-158804: Changing signature of method used as delegate breaks code

$
0
0
Reporter Hadi Hariri (hadihariri) Hadi Hariri (hadihariri)
Created Feb 17, 2010 4:43:15 PM
Updated Apr 7, 2018 9:31:52 AM
Resolved Apr 7, 2018 9:31:52 AM
Subsystem Refactorings
Assignee Alisa Afonina (alisa.afonina)
Priority Normal
State Obsolete
Type Feature
Fix version Backlog
Affected versions No Affected versions
Fixed In Version ReSharper Undefined
VsVersion All Versions
From User on Twitter.

/*
If I go to [2] and call "extract parameter" on arg, call in [3] will break, instead of changing to new Bar().Baz(() = >MyAction(arg));

"extract parameter": the method no longer fits signature of the delegate. R# should wrap it in a lambda to compensate for that change IMO
  • /

public class Foo
{
private int arg = 1;

public void MyAction()
{
Console.WriterLine(arg); // [2]
}

public void UseBar()
{
new Bar().Baz(MyAction); // [3]
}

}

public class Bar
{
public void Baz(Action a)
{
}
}

Viewing all articles
Browse latest Browse all 106942

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>