Disable the insertion of a space after closing braces and before the else keyword

mab0189 0 Reputation points
2023-03-14T01:46:04.2966667+00:00

I'm using Visual Studio 2022 Community and configured it according to my personal formatting preferences but i couldn't find the option to turn of the space insertion after the } closing brace and before the else keyword (see example below). Can someone pleas tell me the right option?

// What i currently get with my settings:
} else{

// What i want:
}else{ 
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,449 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 34,341 Reputation points Microsoft External Staff
    2023-03-14T09:02:20.15+00:00

    Hello @mab0189

    Welcome to Microsoft Q&A forum.

    Please try to uncheck this option: Tools => Options => Text Editor => C# => Code Style => Formatting => General => Automatically format block on }.User's image

    Please feel free to let us know if it meets your requirement.

    Sincerely,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.