如何将所包含的项添加到文档注释中

我正在尝试编写文档注释但是我遇到了问题。

///  /// Inserts an element into the System.Collections.Generic.List at the specified /// index. ///  

当我到达 Visual Studio认为我正在尝试添加另一个标签。 添加这样的评论的正确方法是什么(如果我可以在生成的帮助文本中点击它们,这将是一个额外的奖励)

C#文档注释是XML,因此将<>更改为<>

不过,你最好做的是使用标签插入超链接。 在标记中,将更改为{T}

 ///  /// Inserts an element into the  at the specified /// index. ///  

(请注意,与普通文本不同,编译器对cref属性进行语法检查。)

转义xml实体。

改为&lt; T&gt;

我相信这对您有所帮助: C#XML文档注释常见问题解答 。

由于注释是xml,因此您可以为xml使用适当的转义序列:

 /// Inserts an element into the System.Collections.Generic.List<T> at the specified 

您需要使用正确的字符代码: &lt ; 和&gt ;.

您可能希望在标记中找到整个System.Collections.Generic.List

我实际上不得不使用上面提到的标签来正确地写这个答案:)