Search code examples
c#visual-studioformattingrichtext

Basic text formatting in visual studio comments?


For decades c, c++ c# comments have been plain ASCII text.

Is there any way to do basic Rich Text style comments in c#? Just simple stuff like bullet points or numbered points, bold, italics and indents, nothing more. It would make my commenting much easier to read. Seems like the world moved on from basic ASCII, but the c# comments were left behind


Solution

  • Well, the C# comments are just a plain text. If you want to use any formatting, you must encode it somehow (markdown, prefix, XML tags) and use some extension to show it formatted in Visual Studio.

    I don't know if you need the formatting just for you while reading your source code or also for documentation generated out of the comments. For the latter case, there is a standard way available - XML comments. Use the <list> for bullet and numbered lists.

    Of course, you don't see formatted text directly in VS. However, you can preview or edit such a comment in VS with WYSIWYG comment editor included in VSdocman (I'm the author of this extension).