Visual Studio 2015 Curly Brace Formatting: If, Else If, ​​Else

I recently upgraded to Visual Studio 2015 (Update 1) and got the settings the way I want them to be, however I have a little formatting problems regarding curly braces! I assume that the second code sample is a more acceptable convention, but I cannot get the correct settings. What am I doing wrong here?

Visual Studio is currently automatically formatting my code like this, pay attention to else {

    public static string Gender(string x)
    {
        if (x == "M")
        {
            return "Male";
        }
        else if (x == "F")
        {
            return "Female";
        }
        else {
            return "Unknown";
        }
    }

I would like my code to be automatically formatted as

    public static string Gender(string x)
    {
        if (x == "M")
        {
            return "Male";
        }
        else if (x == "F")
        {
            return "Female";
        }
        else
        {
            return "Unknown";
        }
    }
+4
source share
1 answer

Visual Studio 2015 1 , .

un " ".

, (http://imgur.com/XPvH8pI)

enter image description here

-1

Source: https://habr.com/ru/post/1622379/


All Articles