title: Creating an object from a hash table C#
body: <p>In C#
  Given a hash table like {id:'1', name:'foo'}</p>
  
  <p>How can I dynamically create an instance of a class that has the same members?</p>
  
  <pre><code>public class product {
      public int id;
      public string name;
  }
  </code></pre>
  
  <p>I know I'm going to run into problems casting but I will deal with those later.  Right now I can't even access the members of the class based on the key of the hashtable.  Am I going about this the right way?</p>
  
  <p>This is the way I'm currently going about it.</p>
  
  <pre><code>product p = new product();
  Type description = typeof(product);
  foreach (DictionaryEntry d in productHash)
  {
      MemberInfo[] info = description.GetMember((string)d.Key);
      //how do  I access the member of p based on the memberInfo I have?
      //p.&lt;?&gt; = d.Value;
  }
  </code></pre>
  
  <p>Thanks</p>