首页 技术 正文
技术 2022年11月18日
0 收藏 330 点赞 3,387 浏览 1300 个字

在新建一个C#类时,为了描述该类的功能、以及文件建立的相关信息,并保护自己的版权要在文件的开头添加一些信息。如下:

 /***********************************************************************************
* Filename :Class3
* Description :
* Date:2014/5/15 16:31:29
* Machinename:PC-201305061330
* Created by: <T> Andy Sun
* All rights reserved
*
* ChangeLog:
* 2014/5/15 16:31:29:
* Created!
************************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

而手动添加即费时又费力,好在vs为我们提供了模版更改接口,下面就来简单介绍一下。

1、首先,要找到C#类模版的所在。一般情况下会是在%VS安装目录%\Common7\IDE\ItemTemplatesCache\CSharp\Code\2052\Class(或%VS安装目录%\Common7\IDE\ItemTemplates\CSharp\Code\2052\Class)中的class.cs文件。

2、打开该文件,文件头部添加如下信息:

 /***********************************************************************************
* Filename :$safeitemrootname$
* Description :
* Date:$time$
* Machinename:$machinename$
* Created by: <T> Andy Sun
* All rights reserved
*
* ChangeLog:
* $time$:
* Created!
************************************************************************************/
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$
{
class $safeitemrootname$
{
}
}

3、保存文件后,新建C#类时即可看到在文件头部自动添加了相关信息。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,000
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,512
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,358
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,141
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,771
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,849