[Note] 使用Code Snippet简化编码
使用NewtonSoft.Json写实体类时大量格式一致的代码出现 ,这时可以使用Code snippet来加快编码速度
[JsonProperty(PropertyName = "message"]
public string Message { get; set;}
我把这个代码片段叫做jsonp , 要输入这两行代码时输入 jsonp 然后按 Tab就搞定了,还可以继续按Tab修改属性的名字
Snippet文件如下
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>jsonp</Title>
<Shortcut>jsonp</Shortcut>
<Description>Code snippet for JsonProperty</Description>
<Author>x wang</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal Editable="true">
<ID>type</ID>
<Default>string</Default>
<Function/>
</Literal>
<Literal Editable="true">
<ID>field</ID>
<Default>fieldname</Default>
<Function/>
</Literal>
<Literal Editable="true">
<ID>Property</ID>
<Default>PropertyName</Default>
<Function/>
</Literal>
</Declarations>
<Code Language="csharp"><![CDATA[
[JsonProperty(PropertyName = "$field$")]
public $type$ $Property$ { get; set;}
]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
参考链接
Visual Studio 的代码片段(Code Snippet)功能
[Note] 使用Code Snippet简化编码的更多相关文章
- 使用 Code Snippet 简化 Coding
在开发的项目的时候,你是否经常遇到需要重复编写一些类似的代码,比如是否经常会使用 for.foreach ? 在编写这两个循环语句的时候,你是一个字符一个字符敲还是使用 Visual Studio 提 ...
- C# 使用 Code Snippet 简化 Coding
在开发的项目的时候,你是否经常遇到需要重复编写一些类似的代码,比如是否经常会使用 for.foreach ? 在编写这两个循环语句的时候,你是一个字符一个字符敲还是使用 Visual Studio 提 ...
- Visual Studio 如何使用代码片段Code Snippet提高编程速度!!!
使用Code Snippet简化Coding 在开发的项目的时候,你是否经常遇到需要重复编写一些类似的代码,比如是否经常会使用 for.foreach ? 在编写这两个循环语句的时候,你是一个字符 ...
- 善用VS中的Code Snippet来提高开发效率
http://www.cnblogs.com/anderslly/archive/2009/02/16/vs2008-code-snippets.html http://www.cnblogs.com ...
- 善用VS中的Code Snippet来提高开发效率 分类: C# 2015-01-22 11:06 69人阅读 评论(0) 收藏
前言 在谈谈VS中的模板中,我介绍了如何创建项目/项模板,这种方式可以在创建项目时省却不少重复性的工作,从而提高开发效率.在创建好了项目和文件后,就得开始具体的编码了,这时又有了新的重复性工作,就是 ...
- 创建自己的Code Snippet(代码模板)
一.名词解释 Code Snippet,代码模板,是一种快速生成代码的快捷方式,使用它可以有效地提高编程效率. 编程中可以使用Visual Studio提供的预先设置好的Code Snippet,也可 ...
- ios 显示代码块(show the code snippet library)
在项目的实际开发中,我们会重复的书写很多的代码,我经常是需要用到某一个功能,就从以前的项目中复制粘贴过来,很是麻烦 下面就为大家提供两种不错的方法, 一.宏定义,这个大家应该很熟悉,在这里就不做多的介 ...
- Xamarin.Forms XAML的辅助功能Code Snippet
Xamarin.Forms XAML的辅助功能Code Snippet 在Visual Studio中,使用Code Snippet(代码片段)功能可以减少基础代码的编写量,如常见的标签.循环语句 ...
- VS里的 代码片段(Code snippet)很有用,制作也很简单
工欲善其事必先利其器,而 Visual Studio 就是我们的开发利器. 上一篇文章,介绍了一个很棒的快捷键,如果你还没用过这个快捷键,看完之后应该会豁然开朗.如果你已经熟练的应用它,也会温故而知新 ...
随机推荐
- Eclipse批量注释、批量缩进、批量取消缩进技巧
1.批量注释:选中若干行,按"Ctrl"+"/" 2.批量缩进:选中若干行,按TAB 3.批量取消缩进:选中若干行,按SHIFT+TAB
- hdu-6681 Rikka with Cake
题目链接 hdu-6681 Problem Description Rikka's birthday is on June 12th. The story of this problem happen ...
- hdu4565 So Easy!(矩阵快速幂)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4565 题解:(a+√b)^n=xn+yn*√b,(a-√b)^n=xn-yn*√b, (a+√b)^n ...
- Codeforces Round #391 C. Felicity is Coming!
题目链接 http://codeforces.com/contest/757/problem/C 题意:给你n组数范围在1-m,可进行变换f(x)=y,就是将所有的x全变成y,最后 要满足变化后每组数 ...
- poj 2777 Count Color(线段树(有点意思))
题目链接 http://poj.org/problem?id=2777 题意:题意是有L个单位长的画板,T种颜色,O个操作.画板初始化为颜色1.操作C讲l到r单位之间的颜色变为c,操作P查询l到r单位 ...
- 最长上升子序列模板 hdu 1087 Super Jumping! Jumping! Jumping!
Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. May ...
- yzoj1568: 数字组合 题解
题意 从n个数中选出和为m的组合个数(输入顺序不同的数是不同的) 输入样例: 4 4 1 1 2 2 输出样例 3 我们把每个数看作一件物品,它的重量就是它的值,价值就是1,而和m即为背包的容积,故背 ...
- 【Offer】[16] 【数值的整数次方】
题目描述 思路分析 测试用例 Java代码 代码链接 题目描述 实现函数double Power(double base, int exponent),求base的exponent次方.不得使用库函数 ...
- Hello, OpenWrite
目录 Markdown For Typora Overview Block Elements Paragraph and line breaks Headers Blockquotes Lists T ...
- 深度剖析Vue中父给子、子给父、兄弟之间传值!
本片文章将为您详细讲解在Vue中,父给子传值.子给父传值以及兄弟之间传值方式! 父传子:父组件 // template里面 <aa :info="name"/> // ...