I know this maybe a basic question but I just can't seem to find the answer anywhere.
I have a class like this
Table<T>
{}
then I have some code that uses the above class that I would like to comment I would like to be able to do something like:
/// <summary>
/// blah blah blah Table<String>
/// </summary>
But I can't use the angle bracket in the comment as it thinks it's a tag and when the help shows up it just has an error about no end tag for .
How do I show generic classes in comments in Visual Studio.
To insert XML comments for a code element Do one of the following: Type /// in C#, or ''' in Visual Basic. From the Edit menu, choose IntelliSense > Insert Comment. From the right-click or context menu on or just above the code element, choose Snippet > Insert Comment.
C# documentation comments use XML elements to define the structure of the output documentation. One consequence of this feature is that you can add any valid XML in your documentation comments. The C# compiler copies these elements into the output XML file.
XML documentation comments - document APIs using /// comments | Microsoft Learn.
You need to use XML entities (sort of escape sequences): < for < and > for >. Intellisense will display < as and > correctly.
EDIT: Here's a cheat sheet listing of all of the XML entities:
< for <
> for >
& for &
" for "
' for '
try using an < instead of a <
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