對於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模版裡面的宏。
其他可用的參數有:(需要注意:這些參數區分大小寫。)