Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop Resharper toggling between Enumerable.ToList and Select suggestion

If I use the Resharper code cleanup function, I'm finding my code ...

var personInfos = persons.Select(Mapper.Map<PersonInfo>).ToList();

is changed to ...

var personInfos = Enumerable.ToList(persons.Select(Mapper.Map<PersonInfo>));

But then Resharper makes a suggestion "To extension method invocation" for the Enumerable.ToList so the code goes back to ...

var personInfos = persons.Select(Mapper.Map<PersonInfo>).ToList();

I've checked in the Resharper code editing options, but I can't see where/how I can stop this toggling behaviour

like image 817
SteveC Avatar asked Nov 18 '15 11:11

SteveC


1 Answers

I think @Matthias may be correct

I've updated to current Resharper, i.e. 2016.1.2 and tried the code ...

var personInfos = persons.Select(Mapper.Map<PersonInfo>).ToList();

Resharper no longer offers a suggestion

And @Vlad274 this is with my code cleanup Optimise 'using' directives and Shorten qualified references both still checked

like image 82
SteveC Avatar answered Oct 17 '22 06:10

SteveC