How to add items enclosed by < > to documentation comments
I am trying to write documentation comments however I have a problem.
/// <summary>
/// Inserts an element into the System.Collections.Generic.List<T> at the specified
/// index.
/// </summary>
When I reach the <T>
Visual studio thinks I am trying to add another tag. what is the correct way to add comments like that (and if I could make them click able in the generated help text that would be a e开发者_StackOverflow中文版xtra bonus)
C# documentation comments are XML, so change your <
and >
to <
and >
.
What you're better off doing, though is, is using the <see>
tag to insert a hyperlink. In a <see>
tag, change <T>
to {T}
:
/// <summary>
/// Inserts an element into the <see cref="List{T}"/> at the specified
/// index.
/// </summary>
(Note that the cref
attribute is syntax-checked by the compiler, unlike ordinary text.)
escape the xml entities.
Change <T> into <T>
I believe this would be of help for you: C# XML documentation comments FAQ.
Since the comment is xml you can use appropriate escape sequences for xml:
/// Inserts an element into the System.Collections.Generic.List<T> at the specified
You need to use the proper char codes: <
; and >
;.
You would want to surreound the whole System.Collections.Generic.List<T> in a <see cref="..."/>
tag.
I actually had to use the above mentioned tags to correctly write this answer :)
精彩评论