Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
161 views
in Technique[技术] by (71.8m points)

c# - How to stop ReSharper removing spaces in object initializer

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?

question from:https://stackoverflow.com/questions/3280361/how-to-stop-resharper-removing-spaces-in-object-initializer

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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".


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...