I recently upgraded to Visual Studio 2015 (update 1) and have been getting things configured as I want them to be, however I am having a little trouble with formatting with regards to curly braces! I am under the assumption that the 2nd code sample is the more accepted convention, yet I can not seem to get my settings right. What am I doing wrong here?
Visual Studio is currently auto-formatting my code like this, notice the 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 auto-formatted like this
public static string Gender(string x)
{
if (x == "M")
{
return "Male";
}
else if (x == "F")
{
return "Female";
}
else
{
return "Unknown";
}
}
I have Visual Studio 2015 Update 1 and have it set up to format like in your second code snippet.
An important setting is to uncheck "place else on new line" option.
If this is not enough, I am posting a screenshot with all my settings (http://imgur.com/XPvH8pI)
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