Lets say I have the following code in C#
var stringList = GetListOfStrings();
var firstString = stringList.Where(s => true)
.Where(s => true)
.Where(s => true)
.FirstOrDefault();
It doesn't do very much, but it's formatted in the way I like by ReSharper and by Resharpers Code Cleanup feature.
Now lets say I rewrite that code to just call the method GetListOfStrings
without assigning it to a variable first. In this situation Resharper formats it as follows:
var firstString = GetListOfStrings()
.Where(s => true)
.Where(s => true)
.Where(s => true)
.FirstOrDefault();
Is there anyway to change this so ReSharper formats it as below instead?
var firstString = GetListOfStrings().Where(s => true)
.Where(s => true)
.Where(s => true)
.FirstOrDefault();
I'm using the ReSharper 8 Beta and VS 2013 preview if it makes any difference.
I think you're looking for the "Chained Method Calls" option under the "Align Multiline Constructs" header here:
With Resharper, you can use the following options:
Code Editing
->C#
->Formatting Style
->Line Breaks and Wrapping
->Line Wrapping
->Wrap chained method calls
to Chop always
and
enable Code Editing
->C#
->Formatting Style
->Other
->Align Multiline Constructs
->Chained method calls
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With