惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Project Zero
Project Zero
Security Archives - TechRepublic
Security Archives - TechRepublic
C
Cyber Attacks, Cyber Crime and Cyber Security
Security Latest
Security Latest
Scott Helme
Scott Helme
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
V
Vulnerabilities – Threatpost
C
CERT Recently Published Vulnerability Notes
S
Schneier on Security
G
GRAHAM CLULEY
L
Lohrmann on Cybersecurity
D
Darknet – Hacking Tools, Hacker News & Cyber Security
I
Intezer
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
F
Full Disclosure
T
The Exploit Database - CXSecurity.com
P
Proofpoint News Feed
WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
H
Help Net Security
大猫的无限游戏
大猫的无限游戏
MyScale Blog
MyScale Blog
Hacker News: Ask HN
Hacker News: Ask HN
G
Google Developers Blog
H
Heimdal Security Blog
O
OpenAI News
Hugging Face - Blog
Hugging Face - Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
L
LangChain Blog
C
Cisco Blogs
云风的 BLOG
云风的 BLOG
IT之家
IT之家
Cyberwarzone
Cyberwarzone
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Know Your Adversary
Know Your Adversary
博客园 - 聂微东
The Cloudflare Blog
C
Check Point Blog
K
Kaspersky official blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
月光博客
月光博客
T
Tor Project blog
T
Threat Research - Cisco Blogs
T
Tailwind CSS Blog
P
Proofpoint News Feed
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
A
About on SuperTechFans
小众软件
小众软件
Cloudbric
Cloudbric
A
Arctic Wolf

博客园 - 蔡秋心

Windows Azure VM的两种shut down 方式 转贴: A Simple c# Wrapper for ffMpeg PowerShell: 找到一个目录下最新的文件 PowerShell: 如何解决File **.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get- help about_sig" for more de 在localhost上使用fiddler 在SQL Server Business Intelligence Development Studio中编辑Dynamcis CRM中的Report Report Design: Best Practices and Guidelines Visual Studio使用小技巧6 – 为代码加上Using(Resolve using)和管理Using(Organize using) Visual Studio使用小技巧5 – 区块选择(box selection)的拷贝(copy)和粘贴(paste) Visual Studio使用小技巧4 – Where am I(在Solution Explorer中显示当前文档) Visual Studio使用小技巧3 – 标签分组(Tab Group)和分割窗口(Split window) Visual Studio使用小技巧2 – 使用任务列表(task list) - 补充 Visual Studio使用小技巧2 – 使用任务列表(task list) Visual Studio使用小技巧1 – HTML编辑器中的格式化 部署Dotnetnuke Site到虚拟目录和端口不为80的网站 asp.net使用COM组件需要的权限设置 前台线程(Foreground Threads)和后台线程(Background Threads) 在Dynamics CRM 的 Entity Form中显示记录的ID的方法 如何使用VS2005创建web安装包
使用Visual Studio中的Item Template
蔡秋心 · 2009-06-30 · via 博客园 - 蔡秋心

通常visual studio的默认文件模版并不能满足我们的需求.

下面是默认的由vs2008创建的类Class2.cs

using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace TestLogin
{
    public class Class2
    {
    }
}

我们不需要引用那么多命名空间,至少System.Linq一般不会使用.另外通常我们会在文件头加入copyright.

这时候我们就可以用到item template 文件模版

1. 创建或者打开一个工程

2. 加入一个item,并做适当的修改.我们以上面的Class2.cs为例.修改为下面

    /*
    * Copyright by Simon Cai 2009
    * */
    using System;

    namespace TestLogin
   {
        public class Class2
       {
        }
    }

3. 在File菜单中选择Export Template...

    注意Export Template默认是不存在的.我们可以加入.参见

    http://www.xmlx.net/software/2006/02/missing_command.html

4. 选择Item Template

   

5. 选择要导出的类

   

6. 选择这个类使用到的命名空间.

   

7. 输入模版的名字和描述

   

现在我们就有了一个item template,它已经被import到了vs中,因为我们选中了"Automatically import the template into visual studio"

下一次我们想加入一个新类的时候在My Templates中选择这个模版就可以了.如下图所示,船舰一个新类叫csdnTest.cs

新创建的类向下面的样子:

/*
 * Copyright by Simon Cai 2009
 * */
using System;

namespace TestLogin
{
    public class csdnTest
    {
    }
}

参考:

http://msdn.microsoft.com/en-us/library/tsyyf0yh.aspx