How to disable Block on single Line in Visual Studio 2015.

When you create an auto property in Visual Studio 2015 , you will notice that it would be in a single line as shown below.

public int Name { get; set; }

When you use the shortcut for formatting in Visual Studio 2015 (Ctrl + K and Ctrl +D) , you will notice that the formatting would stay like the one shown in the above code.

There are times when you might want to have this formatting in multi-line instead of a single line. (I would prefer single line though :)).

How to Disable Block on single Line in Visual Studio 2015 ?

To change this behaviour , follow the below steps.

1. Launch Visual Studio 2015 and navigate to Tools -> Options.

2. In the Options Dialog left sidebar , select Text editor -> C# -> Formatting -> Wrapping and then uncheck the option “Leave block on single line”.

image

3. Click ok button and now apply the formatting. You should see the auto property in multi-line as shown below.

public string Name
{
    get; set;
}

Leave a Reply