Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I Format Linq methods to stack vertically with Resharper?

Tags:

c#

linq

resharper

Is there a way in Resharper to format all linq methods to stack up on each other vertically. I have some code which look like this:

xTable.Include(x => x.RelatedTable.Select(y => y.Childrens)).Include(x => x.SomeField).Where(x => x.Guid == token).ToList();

I would like to format the code to look like this:

    xTable.Include(x => x.RelatedTable.Select(y => y.Childrens))
          .Include(x => x.SomeField)
          .First(x => x.Guid == token)
          .ToList();
like image 442
Saber Avatar asked Jun 04 '26 03:06

Saber


1 Answers

I think you're after one of these two items in the Options page:

Code Editing
  ->C#
    ->FormattingStyle
      ->Other
        -> Align Multiline Constructs
          -> 1) LINQ query
          -> 2) Chained method calls
like image 63
LordWilmore Avatar answered Jun 06 '26 19:06

LordWilmore