自定义vs新建文件的开头部分以及类修饰符

1、找到Visual Studio安装目录
C:Program Files (x86)Microsoft Visual Studio 12.0Common7IDEItemTemplatesCacheCSharpCode2052Interface

打开其中的Interface.cs(接口添加public)

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$
{
    public interface $safeitemrootname$
    {
    }
}

  

C:Program Files (x86)Microsoft Visual Studio 12.0Common7IDEItemTemplatesCSharpCode2052Class

打开其中的class.cs(接口添加class)

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$
{
    public  class $safeitemrootname$
    {
    }
}

  然后保存即可生效,当然需要默认添加 public partial 局部类关键字也是可以的。

搬运自:https://blog.csdn.net/qq_28522783/article/details/80448315

原文地址:https://www.cnblogs.com/zyc19910109/p/9441122.html