Delphi中的注释方法?

FLC*_*ver 27 delphi documentation xml-documentation

我有一段代码需要一些严肃的文档,并想询问是否有类似于C#/ .NET的In-code XML-Documentation的功能可用于Embarcadero Delphi.我的目的是以在Delphi XE3的自动完成中突出显示的方式显示有关如何正确使用特定方法的某些信息.

像这样(C#):

/// <summary>
/// Some useful information helping other developers use this method correctly
/// </summary>
public static void ADocumentedMethod();
Run Code Online (Sandbox Code Playgroud)

Delphi XE3是否支持这样的东西?

谢谢你的阅读.

Dav*_*nan 37

该功能名为XML文档注释,在此处记录.它似乎已经在等效的.net功能上进行了密切建模,因此您应该在家中使用它.

该文档包含以下示例:

/// <summary> Removes the specified item from the collection
/// </summary>
/// <param name="Item">The item to remove
/// </param>
/// <param name="Collection">The group containing the item
/// </param>
/// <remarks>
/// If parameter "Item" is null, an exception is raised.
/// <see cref="EArgumentNilException"/>
/// </remarks>
/// <returns>True if the specified item is successfully removed;
/// otherwise False is returned.
/// </returns>
function RemoveItem(Item: Pointer; Collection: Pointer): Boolean;
begin
  // Non-XML DOC comment
  // ...
end;
Run Code Online (Sandbox Code Playgroud)

这导致了这个帮助洞察提示:

在此输入图像描述

还有各种其他方法来处理和使用文档.

  • 此外,此 XML 文档应该出现在单元的“接口”部分中,以便在外部单元中显示。 (2认同)