所有这些其他的答案都有意义,但是不完整。VisualStudio 将处理 XML 注释,但必须打开它们。下面是如何做到这一点:
Intellisense 将使用您在源代码中输入的 XML 注释,但必须通过 VisualStudio 选项启用它们。转到 Tools > Options > Text Editor。对于 VisualBasic,启用 Advanced > Generate XML documentation comments for '''设置。对于 C # ,启用 Advanced > Generate XML documentation comments for ///设置。当输入时,Intellisense 将使用摘要注释。在编译引用的项目之后,它们将可从其他项目获得。
要创建 外部文档,您需要通过控制编译器的 /doc选项的 Project Settings > Build > XML documentation file:路径生成一个 XML 文件。您将需要一个外部工具,该工具将 XML 文件作为输入,并以您选择的输出格式生成文档。
/// <summary>
/// Adds two numbers and returns the result
/// </summary>
/// <param name="first">first number to add</param>
/// <param name="second">second number to </param>
/// <returns></returns>
private int Add(int first, int second)
{
return first + second;
}