1、找到以下目录
D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\ItemTemplates\Web\CSharp\2052\Class
D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\ItemTemplates\CSharp\Code\2052\Class
2.在Class.cs 文件中添加如下代码。
/* * ============================================================================== * * Filename: $safeitemname$ * Description: * * Version: 1.0 * Created: $time$ * Compiler: Visual Studio 2010 * * Author: Your name * Company: Your company name * * ============================================================================== */
或者:
/************************************************************************************* * CLR版本: $clrversion$ * 类 名 称: $safeitemrootname$ * 机器名称: $machinename$ * 命名空间: $rootnamespace$ * 文 件 名: $safeitemname$ * 创建时间: $time$ * 作 者: xxx * 说 明:。。。。。 * 修改时间: * 修 改 人: *************************************************************************************/
添加后:
Web目录下对应 Class.cs:
using System; using System.Collections.Generic; $if$ ($targetframeworkversion$ >= 3.5)using System.Linq; $endif$using System.Web; /************************************************************************************* * CLR版本: $clrversion$ * 类 名 称: $safeitemrootname$ * 机器名称: $machinename$ * 命名空间: $rootnamespace$ * 文 件 名: $safeitemname$ * 创建时间: $time$ * 作 者: xxx * 说 明:。。。。。 * 修改时间: * 修 改 人: *************************************************************************************/ public class $safeitemrootname$ { public $safeitemrootname$() { // // TODO: 在此处添加构造函数逻辑 // } }
CSharp目录下对应Class.cs文件:
using System; using System.Collections.Generic; $if$ ($targetframeworkversion$ >= 3.5)using System.Linq; $endif$using System.Text; $if$ ($targetframeworkversion$ >= 4.5)using System.Threading.Tasks; $endif$ namespace $rootnamespace$ { /************************************************************************************* * CLR版本: $clrversion$ * 类 名 称: $safeitemrootname$ * 机器名称: $machinename$ * 命名空间: $rootnamespace$ * 文 件 名: $safeitemname$ * 创建时间: $time$ * 作 者: xxx * 说 明:。。。。。 * 修改时间: * 修 改 人: *************************************************************************************/ class $safeitemrootname$ { } }
3.这样在新建c#类文件时就会自动添加注释说明信息了。
using System; using System.Collections.Generic; using System.Text; namespace TerminalMACS.Clients.App.Models { /************************************************************************************* * CLR版本: 4.0.30319.42000 * 类 名 称: Class1 * 机器名称: DESKTOP-OHIDTJ6 * 命名空间: TerminalMACS.Clients.App.Models * 文 件 名: Class1 * 创建时间: 2020/3/22 19:40:15 * 作 者: xxx * 说 明:。。。。。 * 修改时间: * 修 改 人: *************************************************************************************/ class Class1 { } }
除非注明,文章均由 Dotnet9 整理发布,欢迎转载。
转载请注明:
作者:Dotnet9
链接:https://dotnet9.com/10968.html
来源:Dotnet9
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。