title: using collection of strings in a switch statement
body: <p>I'm trying to find a solution for this problem. This is my example code:</p>
  
  <pre><code>class Program
  {
    private string Command;
  
    private static string[] Commands = { "ComandOne", "CommandTwo", "CommandThree", "CommandFour" };
  
  
    static void Main(string[] args)
    {
      Command = args[0];
      switch(Command)
      {
        case Commands[0]: //do something 
          break;
        case Commands[1]: //do something else
          break;
        case Commands[2]: //do something totally different
          break;
        case Commands[3]: //do something boring
          break;
        default: //do your default stuff
          break;
      }
    }
  
    void DifferentMethod()
    {
      foreach(string c in Commands)
      {
        //do something funny
      }
    }
  }
  </code></pre>
  
  <p>This code doesn't work because the string values in the switch are not constants. I want to write easy maintainable code.<br>
  I like to use something like an array because I need to use the same values somewhere else in a loop.<br>
  With int-values an enum would be perfect, but I didn't find a small solution for the same thing with strings. </p>