title: Constraining enum value in method parameter
body: <pre><code>enum Fruit
  {
      Banana,
      Orange,
      Strawberry
      ...
      ...
      // etc, very long enum
  }
  
  
  PeelFruit(Fruit.Orange);
  PeelFruit(Fruit.Banana);
  PeelFruit(Fruit.Strawberry); // huh? can't peel strawberries!
  </code></pre>
  
  <p>Sorry for the lame example, but hopefully you get the idea. Is there a way to constrain the enum values that <code>PeelFruit</code> will accept?</p>
  
  <p>Obvisouly I could check them in the method with a switch or something, but it would be cool if there was a way to do it that is a) a bit more compact, and b) would cause a compile time error, not a run time error.</p>
  
  <pre><code>[Fruit = Orange,Bannana]
  void PeelFruit(Fruit fruit) { ... }
  </code></pre>