在Visual Studio中使用代码片段提高生产率

Code Snippet是可提升Coding速度的好帮手,懂得善用的人能省下一大堆没营养的打字动作!(这篇switch+enum密技就是很经典的例子)。

Visual Studio提供了一些内置的Snipet.你可以在Code Snippet Manager(Ctrl + K, Ctrl + B)里查看。

image

然后,在编辑的时候,你可以输入Code Snippet的shortcut或者右键菜单选择Insert Snippet应用Code Snippet。

比如你输入#region然后,按TAB,Visual Studio会自动给你生成下面的代码:

image

code snippet这么有用,我们不由自主的就会想加入我们自己的code snippet。SnippetEditor就是帮助你创建code snippet的工具。你可以用它创建code snippet,然后保存成.snippet文件。然后用Code Snippet Manager导入。

image

ref: http://www.dotblogs.com.tw/alonstar/archive/2010/01/06/12837.aspx

转载于:https://www.cnblogs.com/jalenwang/archive/2011/08/28/code_snippet.html

猜你喜欢

转载自blog.csdn.net/weixin_33739646/article/details/93492865