29

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

像这样的东西(C#):

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

Delphi XE3 支持这样的东西吗?

感谢您的阅读。

4

1 回答 1

40

该功能被命名为XML Documentation Comments,并在此处记录。它似乎是在等效的 .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;

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

在此处输入图像描述

还有各种其他方式来处理和使用文档。

于 2013-03-12T12:57:15.527 回答