Fomatting Rules


Here are 2 rules that I cannot find out in the Code Style formatting of Rider for C#

_twitterQuery?.AcceptHeaders.ForEach(contentType =>
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(contentType));

is auto formatted to

_twitterQuery?.AcceptHeaders.ForEach(contentType => { request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(contentType)); });

How can I prevent such behaviour?


Another format that I would like to accept (inline return) :

if (!ShouldRunIntegrationTests) { return; }


{ NoCache = true } is being changed to {NoCache = true}

How to prevent this one too?

Thank you for your help.

1 comment
Comment actions Permalink

Hello Linvi, 

thank you for contacting us. 

For the first, please, try to play with File | Settings | Editor | Code Style | C# | Braces Layout | Lambda and delegate (anonymous method declaration) setting. 

Second issue: set on File | Settings | Editor | Code Style | C# | Line Breaks and Wrapping | Arrangement of Embeded blocks | Place a block with a single simple statement on the same line.  

And the last one: set on File | Settings | Editor | Code Style | C# | Spaces | Within single line accessor. 

Hope this helps! Let me know if you have any other questions. 




Please sign in to leave a comment.