title: Dictionary of Properties in C#
body: <p>I have a series of 'codes' that I want to refer to properties in my class.  However, when I set the values of the dictionary, the properties aren't updated.  An example below</p>
  
  <pre><code>public Foo() {
      this.CodeMap = new Dictionary&lt;string, object&gt;();
      this.CodeMap.Add("stat", this.Status);
      this.CodeMap.Add("ver", this.Version);
  }
  
  public int Status { get; set; }
  
  public int Version { get; set; }
  </code></pre>
  
  <p>And the calling code</p>
  
  <pre><code>foo.CodeMap["stat"] = 27;
  /* foo.Status is not set to 27 */
  </code></pre>
  
  <p>Is there a way to do this in .NET.  I believe the error occurs because the dictionary value isn't an ref value, but I'm not sure the best way to do this.  I saw <a href="https://stackoverflow.com/a/10350484/450745">https://stackoverflow.com/a/10350484/450745</a> but that is kinda the opposite of what I want.</p>