2013-03-12 71 views
24

我有一段代碼需要一些嚴格的文檔,並且想問一下類似於C#/ .NET的In-code XML文檔的功能是否適用於Embarcadero Delphi。 我的目標是顯示一些關於如何正確使用特定方法的信息,方式是在Delphi XE3的Autocompletion中突出顯示。在Delphi中註釋方法?

像這樣(C#):

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

不德爾福XE3支持這樣的事情?

謝謝您的閱讀。

+0

你有哪些Delphi XE3的發行版?你能把這些信息包含在你的問題中嗎? – TLama 2013-03-12 12:50:58

+2

@TLama應該不是真的很重要,AFAIK自D2010以來,/// XML-doc是可用的,所有的SKU,雖然它似乎有點bug ... – ain 2013-03-12 12:52:37

+2

@ain,我正在談論['Documentation Insight'] (http://edn.embarcadero.com/cs/article/41911)據我所知,在Delphi的便宜發行版中,它們有相當大的限制,是不是? – TLama 2013-03-12 12:57:20

回答

32

該功能被命名爲XML文檔註釋並且是documented here。它似乎已經在等效的.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; 

導致此幫助洞察提示:

enter image description here

而且還有許多其他的方式來處理和使用的文檔。

+1

這是完美的!非常感謝你!我覺得有點愚蠢,因爲沒有通過谷歌搜索找到這個。 – FLClover 2013-03-12 13:04:28

+0

此外,這個XML文檔應該出現在單元的「接口」部分,以便在外部單元中顯示。 – Paul 2017-10-10 09:50:34

相關問題