在 Visual Studio 2010 中使用 Resharper 6 自动完成初始化程序 [英] Autocompleting initializer with Resharper 6 in Visual Studio 2010

查看:29
本文介绍了在 Visual Studio 2010 中使用 Resharper 6 自动完成初始化程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有任何方法可以缩短使用 VS 2010 和 Resharper (6) 进行对象初始化的过程.当看到下面的黄色工具提示时,我希望它为每个字段创建一个分配.

I was wondering if there is any way to shortcut the process of object initialization with VS 2010 and Resharper (6). When presented with the yellow tool tip below I'd like to have it create an assignment for each field.

例如,它会生成:

联系方式 = ;联系人 ID = ;创建日期 = ;等等等等

Contact = ; ContactId = ; CreateDate = ; etc, etc

(每个属性一个).

推荐答案

ReSharper 代码完成的工作方式正是如此.输入大括号后,请按 Ctrl+Space 以获取所有属性的列表:

ReSharper code completion works exactly this way. As soon as you've typed in the braces, press Ctrl+Space to get the list of all properties:

var data = new Data {|}

然后,在输入逗号分隔属性后,ReSharper 补全将仅显示您尚未初始化的属性.更重要的是,当您完成属性名称时,它会插入属性和等号.

Then, after entering a comma to delimit properties, ReSharper completion will only show properties that you haven't yet initialized. More importantly, when you complete a property name, it inserts the property and the equals sign.

这篇关于在 Visual Studio 2010 中使用 Resharper 6 自动完成初始化程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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