简体   繁体   English

Delphi中的注释方法?

[英]Annotating Methods in Delphi?

I have a piece of code that needs some serious documenting and wanted to ask whether a feature similar to C#/.NET's In-code XML-Documentation is available for Embarcadero Delphi. 我有一段代码需要一些严肃的文档,并想询问是否有类似于C#/ .NET的In-code XML-Documentation的功能可用于Embarcadero Delphi。 My aim is to display some sort of information on how to use a specific method correctly in the manner that it'd be highlighted in the Autocompletion in Delphi XE3. 我的目的是以在Delphi XE3的自动完成中突出显示的方式显示有关如何正确使用特定方法的某些信息。

Something like this (C#): 像这样(C#):

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

Does Delphi XE3 support something like this? Delphi XE3是否支持这样的东西?

Thank you for reading. 谢谢你的阅读。

The feature is named XML Documentation Comments and is documented here . 该功能名为XML文档注释在此处记录 It appears to have been modelled closely on the equivalent .net feature so you should be right at home with it. 它似乎已经在等效的.net功能上进行了密切建模,因此您应该在家中使用它。

The documentation contains this example: 该文档包含以下示例:

/// <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;

which results in this help insight hint: 这导致了这个帮助洞察提示:

在此输入图像描述

And there are various other ways to process and consume the documentation. 还有各种其他方法来处理和使用文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM