title: How to get value of unknown properties (part solved already with reflection)
body: <p>I have an existing c# application to modify and need to loop through an object with unknown properties and have half solved the problem with reflection.</p>
  
  <p>I'm trying to populate a dictionary with the property name and the property value.  The code is below and I've given a description of what I need in between the ***s</p>
  
  <p>This is an MVC5 project</p>
  
  <pre><code>    private Dictionary&lt;string, string&gt; StoreUserDetails ()
      {      
        var userDetails = new Dictionary&lt;string, string&gt;();
  
        foreach (var userItem in UserItems)
        {
          var theType = userItem.GetType();
          var theProperties = theType.GetProperties();
  
          foreach (var property in theProperties)
          {
            userDetails.Add(property.Name, ***value of userItem property with this property name***);
          }
        }      
        return userDetails;
      }
  </code></pre>
  
  <p>Many thanks in advance for your help.</p>