Tim Peel
Tim Peel

Reputation: 2344

Resharper force space after curly bracket and before closing bracket

Resharper is giving me this:

new MyObject {Prop1 = prop1, Prop2 = prop2}

But I want:

new MyObject { Prop1 = prop1, Prop2 = prop2 }

Currently it's breaking my StyleCop rules.

Upvotes: 35

Views: 5798

Answers (2)

andy p
andy p

Reputation: 1

you can get resharper to match stylecop here by putting these lines in .editorconfig

resharper_space_within_empty_braces = true resharper_space_within_single_line_array_initializer_braces = true

Upvotes: 0

Brian Dishaw
Brian Dishaw

Reputation: 5825

I think this is the setting you are looking for.

http://screencast.com/t/nEXMHo6Ko Dead link

--Edit--

In case of a dead link, The setting is under C# -> Formatting Style -> Spaces -> Within single-line initializer braces. Check the box next to it and you'll be all set.

Upvotes: 58

Related Questions