title: Visual Studio 2017 C# Formatting: One-Line If Statements
body: <p>In Visual Studio 2017 for C#, is there a way to leave one-line if statements on one line without affecting the formatting of other control blocks? The "Place open brace on new line for control blocks" rule under "Text Editor > C# > Code Style > Formatting > New Lines" will allow if statements to remain on one line, but it will also force all other control blocks to have the curly bracket on the same line.</p>
  
  <p>For example, I'd like the following statement's formatting to be left alone:</p>
  
  <pre><code>if(x == null) { return; }
  </code></pre>
  
  <p>Instead of being auto-formatted to this:</p>
  
  <pre><code>if(x == null)
  { return; }
  </code></pre>
  
  <p>While also allowing other control statements to keep their curly bracket on the next line like this:</p>
  
  <pre><code>foreach(string s in strings)
  {
      ....
  }
  </code></pre>