disable C# comment auto-indent

Jon K 0 Reputation points
2023-03-02T17:35:11.1266667+00:00

When I indent a block of code in C#, I do NOT want all of the // to be aligned with the code. Further, if I comment a block out using columns 0 and 1, and hit <ENTER>, I don't want it to auto indent.

I've found how to configure this for C++, but not C#. Is the option just not there? Or am I blind?

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
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,495 questions
Visual Studio Setup
Visual Studio Setup
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Setup: The procedures involved in preparing a software program or application to operate within a computer or mobile device.
1,173 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 31,026 Reputation points Microsoft External Staff
    2023-03-03T09:26:42.9666667+00:00

    Hi @Jon K, 

    Welcome to Microsoft Q&A! 

    Which version of Visual Studio are you using? 

    Please go to Tools > Options > Text Editor > C# > Tabs > Indenting: None.

    You will get the format:

    User's image

    If it doesn’t meet your requirement, please kindly share me some screenshots or steps in order to investigate it further. 

    Sincerely,

    Anna


    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.