title: Dynamic invoke of a method using named parameters
body: <p>We're currently using .NET 3.5 and part of our application uses dynamic invocation (using <a href="http://msdn.microsoft.com/en-us/library/system.reflection.methodbase.invoke.aspx" rel="nofollow">MethodBase.Invoke</a>)</p>
  
  <p>I am wondering if it is possible to mix in Named Parameters (in .NET 4) with dynamic invocation, to perform something similar to:</p>
  
  <pre><code>// Dictionary that holds parameter name --&gt; object mapping
  var parameters = new Dictionary&lt;string, object&gt;();
  
  // Add parameters ....
  
  // Invoke where each parameter will match the one from the method signature.
  methodInfo.Invoke(obj, parameters);
  </code></pre>
  
  <p>Is there any API that allows this option out of the box? If not, is it possible to develop some solution to perform this?</p>
  
  <p>EDIT:</p>
  
  <p>Rethinking of this problem, it sounds similar to how the compiler may actually need to match method calls based on argument lists. Perhaps there's some Compiler API (or the new Roslyn project) that allows doing just this easily? (without coding it myself which may be prone to errors).</p>