title: When to use enums, and when to replace them with a class with static members?
body: <p>It recently occured to me that the following (sample) enumeration...</p>
  
  <pre><code>enum Color
  {
      Red,
      Green,
      Yellow,
      Blue
  }
  </code></pre>
  
  <p>... could be replaced with a seemingly more type-safe class:</p>
  
  <pre><code>class Color
  {
      private Color() { }
  
      public static readonly Color   Red      = new Color();
      public static readonly Color   Green    = new Color();
      public static readonly Color   Yellow   = new Color();
      public static readonly Color   Blue     = new Color();
  }
  </code></pre>
  
  <p>With "type-safe", I mean that the following statement would work if <code>Color</code> was an enum, but not if <code>Color</code> were the above class:</p>
  
  <pre><code>var nonsenseColor = (Color)17;    // works if Color is an enum
  </code></pre>
  
  <h2>Two questions:</h2>
  
  <p><strong>1)</strong> Is there a widely accepted name to this pattern (replacing an enum with a type-safe class)?</p>
  
  <p><strong>2)</strong> In which cases should one use enums, and when would a class be more appropriate?</p>