Alex F Alex F - 3 years ago 153
C# Question

How to prevent asterisk with Enter is pressed inside C# /* */ comments

In VS2012 C# text editor, when Enter is pressed inside

/* */
comments, new line is added, beginning with
. Is it possible to disable this behaviour and get just an empty new line?

From Visual Studio About box, Installed products:

Microsoft Visual Studio Professional 2012
Microsoft Team Explorer for Visual Studio 2012
Microsoft Visual Basic 2012
Microsoft Visual C# 2012
Microsoft Visual C++ 2012
Microsoft Visual F# 2012
Microsoft® Visual Studio® 2012 Code Analysis Spell Checker
NuGet Package Manager
PreEmptive Analytics Visualizer

Answer Source

It seems like this has annoyed other people for a long time, but as you can see if you read that thread, there is a non-intuitive hack to stop it doing this. You have to set the following option to unchecked:

Text Editor > C# > Advanced > Generate XML documentation comments for ///

Screenshot below:


The only downside, is - as the original post says:

Unfortunately, turning this off not only disables the leading asterisk for block comments, but of course also disables the auto-complete feature for XML documentation comments.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download