title: .NET C# switch statement string compare versus enum compare
body: <p>I'm interested in both style and performance considerations.  My choice is to do either of the following ( sorry for the poor formatting but the interface for this site is not WYSIWYG ):</p>
  
  <h1>One:</h1>
  
  <pre><code>string value = "ALPHA";
  
  switch ( value.ToUpper() )
  {
     case "ALPHA":
       // do somthing
       break;
     case "BETA":
       // do something else
       break;
     default:
       break;
  }
  </code></pre>
  
  <h1>Two:</h1>
  
  <pre><code>public enum GreekLetters
  {
      UNKNOWN= 0,
      ALPHA= 1,
      BETA = 2,
      etc...
  
  }
  
  string value = "Alpha";
  GreekLetters letter = (GreekLetters)Enum.Parse( typeof( GreekLetters ), value.ToUpper() );
  
  switch( letter )
  {
     case GreekLetters.ALPHA:
        // do something
        break;
     case GreekLetters.BETA:
        // do something else
        break;
     default:
        break;
  }
  </code></pre>
  
  <p>Personally, I prefer option TWO below, but I don't have any real reason other than basic style reasons.  However, I'm not even sure there really is a style reason.  Thanks for your input.</p>