Does someone have a script or snippet for Visual Studio that automatically removes comment headers for functions or classes?
I want to remove comments like.
/// <summary>
///
/// </summary>
Actually anything that removes comments starting with /// would really help. We have projects with massive amount of GhostDoc comment that really just hides the code and we are not using the document output. It is a tedious work for us to remove theese comments.
To insert XML comments for a code element Type /// in C#, or ''' in Visual Basic.
XML comments help speed development by providing IntelliSense on custom methods and other code constructs. XML comments encourage code reuse by providing a path to generate API style reference documentation from your source code.
The only part of the following comment that's processed is the line that begins with <summary> . The three tag formats produce the same comments. The compiler identifies a common pattern of " * " at the beginning of the second and third lines. The pattern isn't included in the output.
XML documentation comment is a special feature in C#. It starts with a triple slash /// and is used to categorically describe a piece of code.. This is done using XML tags within a comment. These comments are then, used to create a separate XML documentation file.
Open Quick Replace
(CTRL + H) in Visual Studio and replace :b+///.*\n
with an empty string (ensure you set Use
to Regular expressions
). This should allow you to get rid of the comments in the specified scope.
You can use this Regex \/\/\/.*<summary>.*<\/summary>
, with these options gms
, to match the string. You can replace that with nothing. This can be done in Notepad++ or Visual Studio.
Here is a Regex 101 to prove it.
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