2009-01-02 57 views
1

我在哪裏可以找到一個Visual Studio插件,該插件可以爲方法和屬性自動生成文檔標題?自動添加.Net代碼註釋

實例的屬性註釋看起來是這樣的:從http://www.roland-weigelt.de/ghostdoc/

+0

這個評論對任何人都有用嗎? – 2009-01-03 20:18:44

+0

是的,我寧願沒有評論比跛腳。如果該方法沒有評論,至少你知道你可能想回去添加一個。 – 2009-01-04 06:10:54

+0

我的感悟。我的一位同事被迫使用StyleCop,即使在事件的方法頭文檔中,該死的東西也會發現任何錯誤,所以她需要一些自動化。 – Germstorm 2009-01-04 10:33:07

回答

8

Ghostdoc是通常的嫌疑。

作爲另一個提到的海報,Visual Studio也通過在屬性/方法/類定義之前的行上輸入3'///'(正斜線)來做到這一點。

4

GhostDoc

/// <summary> 
/// Gets or sets the value of message 
/// </summary> 
public static string Message   
{ 
    get 
    { 
     return message; 
    } 

    set 
    { 
     message = value; 
    } 
} 
3

Visual Studio自動執行此操作。只要把光標定位直接方法上面進三'/的 例如:

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 

namespace MvcWidgets.Models 
{ 
    /// <summary> 
    /// This is a summary comment 
    /// </summary> 
    public class Comment 
    { 
     /// <summary> 
     /// 
     /// </summary> 
     /// <param name="name"></param> 
     /// <param name="birthdate"></param> 
     /// <param name="website"></param> 
     /// <returns></returns> 
     public int SomeMethod(string name, DateTime birthdate, Uri website) 
     { 
      return 0; 
     } 
    } 
} 

然後,您可以生成一個XML註釋文件,然後使用沙塔生成一個幫助文件。

您可能必須在文本編輯器/ C#/高級選項對話框中啓用此功能。