Vaccano
Vaccano

Reputation: 82301

How to get Resharper to convert back to a foreach loop

Resharper 5 can convert my foreachloops to Linq queries. Which I like. But linq is way way way harder to debug than a foreachloop.

When I convert my foreach statement to a linq query, I don't see any option to go back the other way.

Does any one know how to do this? Is it even possible?

Upvotes: 11

Views: 3528

Answers (2)

Ilya Ryzhenkov
Ilya Ryzhenkov

Reputation: 12142

We are working on LINQ2Foreach (and some other) functionality for ReSharper vNext

Upvotes: 6

AakashM
AakashM

Reputation: 63338

I do not believe this is possible. Certainly, it's not listed in the examples of Quick Fixes, where loop-to-LINQ-expression is shown.

What you should be able to do is use the Context Action 'Convert LINQ to methods chain' to go from the 'fluent' style to the 'methods' style, and then selectively use 'Introduce variable' to pull the expression to pieces.

Upvotes: 2

Related Questions