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.
2,755 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 14,551 Reputation points Microsoft Vendor
    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.