C# Rider How to disable format/reformat in a block of code?

Viewed 1373

I've got some C# code that has specific format that I don't want re-formatted by Rider.

Is there some directive I can add to my code to tell Rider that this section shouldn't be reformatted?

Thanks.

2 Answers

To disable auto formatting for some code block you can use formatter directive:

// @formatter:off

some custom formatted code that should be kept as is.
   
// @formatter:on 

Possibly you will need to enable it in settings: Settings -> Editor -> Code Style -> Formatter Control tab:

enter image description here

Related