简体   繁体   English

Visual Studio 2013代码段/代码模板

[英]Visual Studio 2013 code snippets / code templates

Ie in eclipse there is a place where I can define my own user keywords for autocomplete like: 即在eclipse中,我可以在其中定义自己的自动完成用户关键字,例如:

word: else 词:其他

And template to paste: 和模板粘贴:

else {
    ${cursor}
}

Sorry if this is naive but so far I'm unable to discover such feature in Visual Studio. 抱歉,如果这很幼稚,但到目前为止,我还无法在Visual Studio中发现这种功能。 Does any one of You know where I could find that feature? 你们当中有人知道我在哪里可以找到该功能吗?

In Visual Studio these are called "Code Snippets". 在Visual Studio中,这些称为“代码段”。 This feature is not related to IntelliSense. 此功能与IntelliSense不相关。

There are a number of them built in, for example in C# if you type "ctor" it will create a simple constructor for the class you are in. For other C# snippets see here . 它们有很多内置的,例如在C#中,如果您键入“ ctor”,它将为您所在的类创建一个简单的构造函数。有关其他C#代码段,请参见此处

You can create your own as well. 您也可以创建自己的。

Have a look here: https://msdn.microsoft.com/en-us/library/ms165392(v=vs.140).aspx 在这里看看: https : //msdn.microsoft.com/en-us/library/ms165392(v=vs.140).aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM