title: How to prevent duplicate values in enum?
body: <p>I wonder is there a way to prevent an <code>enum</code> with duplicate keys to compile?</p>
  
  <p>For instance this <code>enum</code> below will compile</p>
  
  <pre><code>public enum EDuplicates
  {
      Unique,
      Duplicate = 0,
      Keys = 1,
      Compilation = 1
  }
  </code></pre>
  
  <p>Although this code</p>
  
  <pre><code>Console.WriteLine(EDuplicates.Unique);
  Console.WriteLine(EDuplicates.Duplicate);
  Console.WriteLine(EDuplicates.Keys);
  Console.WriteLine(EDuplicates.Compilation);
  </code></pre>
  
  <p>Will print</p>
  
  <pre><code>Duplicate
  Duplicate
  Keys
  Keys
  </code></pre>