title: Treat Object Like Dictionary of Properties in C#
body: <p>I want to be able to access property values in an object like a dictionary, using the name of the property as a key. I don't really care if the values are returned as objects, so <code>Dictionary&lt;string, object&gt;</code> is fine. This is the intended usage:</p>
  
  <pre><code>object person = new { Name: "Bob", Age: 45 };
  IDictionary&lt;string, object&gt; lookup = new PropertyDictionary(person);
  string name = (string)person["Name"];
  person["Age"] = (int)person["Age"] + 1; // potentially editable
  </code></pre>
  
  <p>I was about to implement my own class for this, but then I started noticing classes like DynamicObject implement the IDictionary interface, which made think this was already being done for me somewhere.</p>
  
  <p>What I want is similar to the functionality used by ASP.NET MVC that allows using anonymous types to set HTML tag attributes. I have a lot of classes that use dictionaries as data sources, but most of the time I should be able to pass in objects as well.</p>
  
  <p>Since this is for a general-purpose <a href="http://nlist.codeplex.com">library</a>, I thought I would create a reusable class that simply decorated an object with the IDictionary interface. It will save me from creating an explosion of overloads.</p>