Refactor myArray.Select(x => x.MyProp).ToArray() into myArray.Convert(x =>x.MyProp)

A frequent cleaning pattern that I found in code is to convert the following Linq expression
var x = myArray.Select(x => x.MyProp).ToArray();

into the more compact one,
var x = myArray.Convert(x => x.MyProp);

It would be nice if it was part of the auto-suggestion of ReSharper.

Thanks in advance,

Best regards,
Joannes Vermorel
Lokad Sales Forecasting

1 comment

Hello Joannes
     I've created a feature request in our tracker: and you're welcome to monitor its status.

Andrey Serebryansky

Support Engineer

JetBrains, Inc

"Develop with pleasure!"


Please sign in to leave a comment.