vs2015 自定义类模板的方法

来源:互联网 发布:caxa编程视频 编辑:程序博客网 时间:2024/06/04 18:26

第一步:找到模板文件

路径:C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ItemTemplates\CSharp\Code\2052\Class

文件名:Class.cs

 

第二步:将模板文件拷贝到桌面

因为模板文件是只读的,不能直接对它进行直接修改。

 

第三步:修改模板文件

如下:

复制代码
/* *********************************************** * author :  Author * function:  * history:  created by Author  $time$ * ***********************************************/namespace $rootnamespace${    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$    /// <summary>    /// TODO: Update summary.    /// </summary>    public class $safeitemrootname$    {        #region Fields        #endregion        #region Constructors and Destructors        #endregion        #region Public Methods and Operators        #endregion    }}
复制代码

 

第四步:覆盖模板文件

 

搞定!!!

 

现在就可以添加自己的类文件了。

如下:

复制代码
/* *********************************************** * author :  Author * function:  * history:  created by Author 2016/6/15 10:53:37 * ***********************************************/namespace ABC.DbLight.External{    using System;    using System.Collections.Generic;    using System.Linq;    using System.Text;    using System.Threading.Tasks;    /// <summary>    /// TODO: Update summary.    /// </summary>    public class Class1    {        #region Fields        #endregion        #region Constructors and Destructors        #endregion        #region Public Methods and Operators        #endregion    }}
复制代码
0 0
原创粉丝点击