title: How do I dynamically set a variable's value within a class in C#?
body: <p>I'm trying to do something like this:</p>
  
  <pre><code>public class MyClass()
  {
    private void SetAValiable(int boolNumber)
    {
      bool b1 = false;
      bool b2 = false;
  
      ("b" + boolNumber) = true;
    }
  }
  </code></pre>
  
  <p>I've tried this but keep getting a null out of the GetProperty call:</p>
  
  <pre><code>Type myType = typeof(MyClass);
  PropertyInfo pinfo = myType.GetProperty("b" + boolNumber);
  pinfo.SetValue(myType, true, null);
  </code></pre>
  
  <p>Anyone have any thoughts as to how to get this to work?</p>
  
  <p>Thanks!</p>