如何停止ReSharper的去除对象初始化空间 [英] How to stop ReSharper removing spaces in object initializer

查看:123
本文介绍了如何停止ReSharper的去除对象初始化空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢我的对象初始化看起来是这样的:

 新点{标签= g.Key.Name,索赔= G }; 

当打分号键,它们会重新格式化是这样的:

 新点{标签= g.Key.Name,索赔= G}; 



在哪里是要被拆除?


停止我的填充选项< DIV CLASS =h2_lin>解决方案

有关R·7,我能得到这个转到 1



改变

ReSharper的|选项​​|代码编辑| C#|格式样式|空间




和切换




其他|在单行初始化括号




有关其例子是



  INT [] X = INT新[] {0,1,2}; 



  INT [] X = INT新[] {0,1,2}; 



虽然例子是数组初始化的,它也出现控制对象的初始化。






1 <子>在R·5代码编辑是语言。


I like my object initializers to look like this:

new Point { Label = g.Key.Name, Claims = g };

When hit the semicolon key, they get reformatted like this:

new Point {Label = g.Key.Name, Claims = g};

Where is the option to stop my padding from being removed?

解决方案

For R# 7, I can get this to vary by going to1

ReSharper | Options | Code Editing | C# | Formatting Style | Spaces

and toggling

Other | Within single-line initializer braces

the example for which is

int[] x = new int[] {0, 1, 2};

versus

int[] x = new int[] { 0, 1, 2 };

Although the example is of array initialization, it also appears to control object initialization.


1In R# 5, "Code Editing" was "Languages".

这篇关于如何停止ReSharper的去除对象初始化空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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