在C#類檔案 自動添加檔案注釋的方法

來源:互聯網
上載者:User

對於vs2013來講,

步驟:

1.VS2013 中找到(安裝盤符以C盤為例)C:\ProgramFiles(x86)\Microsoft VisualStudio12.0\Common7\IDE\ItemTemplatesCache\CSharp\Code\2052\Class

Code檔案夾指類代碼, 2052檔案夾下的每個檔案的.cs檔案都加也行。。

    若路徑是:

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ItemTemplatesCache\CSharp\Windows Forms\2052\Form

則是添加表單的時候,自動加註釋。


對於vs2008來講,路徑是C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplatesCache\CSharp\Code\2052\Class.zip

2.在Class.cs 檔案最上面 添加如下代碼。

/*
* ==============================================================================
*
* File name: $safeitemname$
* Description: 
*
* Version: 1.0
* Created: $time$
*
* Author: Your name

* Company: Your company name

* * Compiler: Visual Studio 2013
* Machine name: $machinename$
* CLR Version: $clrversion$
*
* ==============================================================================
*/

 

或者:

 

   /*************************************************************************************
     * CLR版本:       $clrversion$
     * 類 名 稱:       $itemname$
     * 機器名稱:       $machinename$
     * 命名空間:       $rootnamespace$
     * 文 件 名:       $safeitemname$
     * 建立時間:       $time$
     * 作    者:         xxx
     * 說   明:
     * 修改時間:
     * 修 改 人:
    *************************************************************************************/

3.這樣在建立c#類檔案時就會自動添加註釋說明資訊了。

我採用的是下面這種:

/*
* ==============================================================================
*
* File name: $safeitemname$
* Description: 
*
* Version: 1.0
* Created: $time$
*
* Author: Your name
* Company: Your company name
*
* ==============================================================================
*/


$safeitemname$、$rootnamespace$ 。。

    這些參數都是系統變數,功能類似於Foxmail模版裡面的宏。

    其他可用的參數有:(需要注意:這些參數區分大小寫。)



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.