title: Accessing constants using string variable
body: <p>I'm working on Unity, using C#, and I made up a script that would make my life simpler if I could access constants using string variables.</p>
  
  <pre><code>public class Foo
  {
      public const string FooConst = "Foo!";
      public const string BarConst = "Bar!";
      public const string BazConst = "Baz!";
  }
  
  // ...inside some method, somewhere else
  public string Bar(string constName)
  {
      // is it possible to do something like this?
      // perhaps with reflections?
      return Foo.GetConstant(constName);
  }
  </code></pre>
  
  <p>My only solution was to create a method that gets the constant inside a <code>switch</code>. But every time I add a new constant, I have to modify that <code>switch</code>.</p>
  
  <p>Fun fact: I'm a PHP kid that moved into C#. I like it is pretty strict, strong-typed and stuff... but that also makes things unnecessarily complicated.</p>