Break lines and wrapping in auto formatting of Visual Studio with ReSharper

C#.NetVisual StudioArchitectureResharper

C# Problem Overview


I'm working in a C# project and using Visual Studio 2012. When Visual Studio tries to format my code, it breaks lines and make my code look difficult to read. The original code (what looks pretty nice to read for me and my team):

if (list.Any(x => x.Type == (int) EnumType.Customer))
{

}

And when Visual Studio tries to format:

if (
    list.Any(
        x => x.Type ==
                (int) EnumType.Customer))
{
  // Other break codes
}

There are a lot of other parts where it is breaking my code. I like auto formatting for some parts, but my question is: Is there a way to disable this break lines from auto formatting in Visual Studio?*

PS: I also have ReSharper installed.

C# Solutions


Solution 1 - C#

Solution for long lines:

ReSharper, menu OptionsCode EditingC#Formatting StyleLine Breaks And Wrapping.

And disable Wrap long lines:

Enter image description here

And it really makes me crazy!

Solution 2 - C#

In ReSharper's settings, in the Languages section, you can change the formatting style of your C# code. The option you're looking to disable is something along the lines of "Indent anonymous method body." You can also look through the options to further customize the formatting style to your preference.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionFelipe OrianiView Question on Stackoverflow
Solution 1 - C#Felipe OrianiView Answer on Stackoverflow
Solution 2 - C#Adam MarasView Answer on Stackoverflow