title: Detect the C# version at compile time
body: <p>Is it possible to detect if the current version of C# is 6 or above with a preprocessor directive, so at compile time?</p>
  
  <p>I want to do something like this:</p>
  
  <pre><code>var myVar = ...;
  string name;
  
  #if VERSION_6_OR_MORE
      name = nameof(myVar);
  #else
      name = "myVar";
  #endif
  </code></pre>
  
  <p>I use Visual Studio 2015 and C# 6, so I can use <code>nameof()</code>. Someone else wanting to compile this code however may be using an older version, where <code>nameof()</code> isn't present. </p>
  
  <p>I want to use a preprocessor directive so I can keep the <code>nameof()</code> in C# 6, but someone else who doesn't use that version can compile it as well.</p>