Question
How do I prevent the closing brace in a collection expression nested in a C# object initializer from being placed on the same line as the collection when using Rider's Reformat Action?
Brace on the same line:
new Foo
{
Prop =
[
1,
2,
], }
Desired behavior:
new Foo
{
Prop =
[
1,
2,
],
}
Answer
Follow these steps:
- Open Settings | Editor | Code Style | C#.
- Navigate to the Line Breaks and Wrapping section.
- Look for the setting Arrangement of list patterns | Wrap list pattern and collection expression.
- Change the setting from Chop if long or multiline to Chop always.
Comments
0 comments
Please sign in to leave a comment.