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

RSRP-102654: Changing lambda to expression

$
0
0
Reporter sean kearon (seankearon) sean kearon (seankearon)
Created Apr 8, 2009 1:32:30 PM
Updated Apr 5, 2018 5:58:17 PM
Resolved Apr 5, 2018 5:58:17 PM
Subsystem Context Actions
Assignee Alisa Afonina (alisa.afonina)
Priority Normal
State Obsolete
Type Bug
Fix version Backlog
Affected versions No Affected versions
Fixed In Version ReSharper Undefined
VsVersion All Versions
I have the following lambda assigned to an event:

ReevaluateButton.ItemClick += (sender, args) => Engine.ReevaluateStatements(); –(1)

I'm aiming at getting to:

ReevaluateButton.ItemClick += (sender, args) => { if (Engine != null) Engine.ReevaluateStatements(); }; –(2)

The route I take is to first add the condition to (1) above:

ReevaluateButton.ItemClick += (sender, args) => if (Engine != null) Engine.ReevaluateStatements(); –(3)

Then I use the context action to take me to an anonymous method, giving:

ReevaluateButton.ItemClick += delegate if (Engine != null) Engine.ReevaluateStatements(); –(4)

To Lambda and Insert Signature from (4) give respectively:

ReevaluateButton.ItemClick += ((sender, args) => ) if (Engine != null) Engine.ReevaluateStatements();
ReevaluateButton.ItemClick += delegate(object sender, ItemClickEventArgs e) { } if (Engine != null) Engine.ReevaluateStatements();

It would be nice to be able to go from (1) to (2) using a To Lambda context action.

Also, if I am at position (3) and type a brace immediately frior to the if I get:

ReevaluateButton.ItemClick += (sender, args) => {}if (Engine != null) Engine.ReevaluateStatements();

It would be nice if this action led to (2) also.

It might be worth noting that http://www.jetbrains.net/jira/browse/RSRP-97543 arose whilst I was doing the refactorings above.

Viewing all articles
Browse latest Browse all 106942

Trending Articles



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