title: Parameter count mismatch in property.GetValue()
body: <p>I'm getting the </p>
  
  <blockquote>
    <p>parameter count mismatch</p>
  </blockquote>
  
  <p>error. It occurs at the <code>if</code> clause. My code:</p>
  
  <pre><code>private Dictionary&lt;string,string&gt; ObjectToDict(Dictionary&lt;string, string&gt; dict, object obj)
  {
      var properties = obj.GetType().GetProperties();
      foreach (var property in properties)
      {
          if (property.GetValue(obj, null) != null)
              dict["{{" + property.Name + "}}"] = property.GetValue(obj, null).ToString();
      }
      return dict;
  }
  </code></pre>
  
  <p>It's strange because it works just fine when I add the <code>property</code> value to the dictionary, but not when I'm testing if it's <code>null</code> in the <code>if</code> clause. </p>
  
  <p>All the questions I've found were putting an incorrect number of arguments into the function call, but AFAIK there's nothing different between my two calls.</p>