title: Using Reflection to update existing Instance
body: <p>I have a Dictionary this contains value pairs that I want to match and update in an instance of a class I have. </p>
  
  <p>So for example I have;</p>
  
  <pre><code>name -&gt; test
  userid -&gt; 1
  </code></pre>
  
  <p>In my Class I then have</p>
  
  <pre><code>MyClass.Name
  MyClass.UserId
  </code></pre>
  
  <p>I would like to set the <code>MyClass.Name = test</code>, etc</p>
  
  <p>Currently I have the method below;</p>
  
  <pre><code> public static GridFilters ParseGridFilters(Dictionary&lt;string,string&gt; data, MyClass myClass)
          {
              foreach (KeyValuePair&lt;string, string&gt; kvp in data)
              {
                  Type t = typeof(MyClass);
                  t.GetProperty(kvp.Value, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance);
  
              }
  
              return myClass;
          }
  </code></pre>
  
  <p>How do I then check if the kvp.Key is in (regardless of case which I think i've covered with the BindingFlags) and then set the kvp.Value to the myClass.(kvp.Key)</p>