我正在嘗試編寫文檔註釋,但是我遇到了問題。如何將< >包含的項目添加到文檔註釋
/// <summary>
/// Inserts an element into the System.Collections.Generic.List<T> at the specified
/// index.
/// </summary>
當我到達<T>
視覺工作室認爲我想添加另一個標籤。什麼是正確的方式來添加這樣的評論(如果我可以讓他們點擊生成的幫助文本,這將是一個額外的獎勵)
我正在嘗試編寫文檔註釋,但是我遇到了問題。如何將< >包含的項目添加到文檔註釋
/// <summary>
/// Inserts an element into the System.Collections.Generic.List<T> at the specified
/// index.
/// </summary>
當我到達<T>
視覺工作室認爲我想添加另一個標籤。什麼是正確的方式來添加這樣的評論(如果我可以讓他們點擊生成的幫助文本,這將是一個額外的獎勵)
C#文檔註釋XML,那麼改變你<
和>
到<
和>
。
你最好做的是使用<see>
標籤插入超鏈接。在<see>
標籤,更改<T>
到{T}
:
/// <summary>
/// Inserts an element into the <see cref="List{T}"/> at the specified
/// index.
/// </summary>
(注意cref
屬性是語法檢查的編譯器,不像普通的文本。)
由於評論是XML,你可以使用適當的轉義序列爲XML:
/// Inserts an element into the System.Collections.Generic.List<T> at the specified
轉義xml實體。
Change <T> into <T>
我相信這將是對你的幫助: C# XML documentation comments FAQ。
您需要使用正確的char代碼:<
;和>
;。
你會想surreound整個System.Collections.Generic.List <牛逼>在<see cref="..."/>
標籤。
其實我不得不使用上述標籤才能正確地寫這個答案:)
謝謝你,我永遠愛一個寫得很好的常見問題 – 2010-03-02 22:40:05
我很高興,如果有幫助 - 它確實表明,有必要在每一刻。 – 2010-03-02 23:28:12