在Visual Studio 2012拥有双卡模板 [英] Own double-tab templates in Visual Studio 2012

查看:112
本文介绍了在Visual Studio 2012拥有双卡模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以这是在Visual Studio中一招,当你,例如对于'型,和双按Tab键,Visual Studio将创建

 的for(int i = 0; I<长度;我+ +)
{

}

有什么办法来创建自己的模板?由于我不使用LINQ,我想,当db.A_被输入,使

 分贝。 A_TableName.Where(K => k.Field ==值)。选择(K => 

{
名称= k.Field
});


解决方案

您很可能指的代码片段。该文档介绍了如何创建新的片段和如何添加它们。这可能是最简单的创建一个基于现有的片段新的,可以在文件夹中找到 C:\Program文件(x86)\Microsoft的Visual Studio 11.0\VC#\Snippets\1033 \Visual C#(取决于您VS版本和操作系统)。


So there's a trick in Visual Studio, that when you type, for example 'for', and double-press the Tab key, Visual Studio will create

for (int i = 0; i < length; i++)
        {

        }

Is there any way to create my own templates? As I don't use LINQ I'd like to, when 'db.A_' is typed, to make

db.A_TableName.Where(k => k.Field == Value).Select(k =>
    new
    {
        Name = k.Field
    });

解决方案

You are probably referring to code snippets. The docs explain how to create new snippets and how to add them. It might be easiest to create new ones based on existing snippets that can be found in the folder C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC#\Snippets\1033\Visual C# (depending on your VS version and OS).

这篇关于在Visual Studio 2012拥有双卡模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆