title: Why is an if statement working but not a switch statement
body: <p>I'm trying to create a <code>switch</code> statement using the char index of a string and an Enum using <a href="https://stackoverflow.com/questions/1851567/chow-to-use-enum-for-storing-string-constants">this</a> wrapper to get the value of the selected enum from a Description. It pretty much allows you to store a string to an enum value.</p>
  <p>Here is my <code>if</code> statement:</p>
  <pre><code>if (msgComingFromFoo[1] == Convert.ToChar(Message.Code.FOO_TRIGGER_SIGNAL.EnumDescriptionToString()))
  {
      //foo
  }
  </code></pre>
  <p>and here is my <code>switch</code> statement:</p>
  <pre><code>switch (msgComingFromFoo[1])
  {
      case Convert.ToChar(Message.Code.FOO_TRIGGER_SIGNAL.EnumDescriptionToString()):
          break;
  }
  </code></pre>
  <p>Why is it accepting the <code>if</code> statement and not the <code>switch</code>? I tried converting it to a char since I'm selecting an index from a string, but unfortunately it didn't work.</p>
  <p><strong>Update:</strong></p>
  <p>Here is the <code>Message.Code</code> Enum</p>
  <pre><code>public class Message
  {
      public enum Code
      {
          [Description(&quot;A&quot;)]
          FOO_TRIGGER_SIGNAL
      }
  }
  </code></pre>
  <p>As you can see, I need the Description assigned to the enum not the enum value that is 0. Using <code>Message.Code.FOO_TRIGGER_SIGNAL.EnumDescriptionToString()</code> from the mentioned wrapper returns <code>A</code> not <code>0</code></p>
  <p><br>Error:</p>
  <blockquote>
  <p>A Constant Value Is Expected</p>
  </blockquote>