如何添加以&lt包含的项目; &GT;到文档注释 [英] 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>
当我到达&LT; T&GT;
的Visual Studio认为我试图添加了一个标签。什么是添加这样的评论的正确方法(如果我可以让他们点击能够在生成的帮助文本,这将是一个额外的奖励)
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 extra bonus)
推荐答案
C#文档注释是XML,因此改变你的&LT;
和&GT;
到&放大器; LT;
和&放大器; GT;
C# documentation comments are XML, so change your <
and >
to <
and >
.
你有什么更好做,虽然是,可以用&LT;见&GT;
标记插入超链接。在&LT;见&GT;
标签,更改&LT; T&GT;
到【T】
:
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>
(请注意, CREF
属性是语法检查由编译器,不像普通的文本。)
(Note that the cref
attribute is syntax-checked by the compiler, unlike ordinary text.)
这篇关于如何添加以&lt包含的项目; &GT;到文档注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!