title: C# MVC Bind variables in a string to model
body: <p>In <code>C# MVC</code> you can use model binding to automatically parse variables to a model.</p>
  
  <pre><code>public class RegistrationForm {
   string Name {get;set;}
   string Address {get;set;} 
  }
  
  public ActionResult Register(RegistrationForm register) {
  ...
  }
  </code></pre>
  
  <p>If I pass the <code>Name</code> and <code>Address</code> variables they are directly available in the <code>register</code> object.</p>
  
  <p>Is it possible to call this binding manually if you have the variables in a string?
  EG:</p>
  
  <pre><code>var s = "name=hugo&amp;address=test";
  
  //dosomething to get RegistrationForm register
  
  //register.Name == hugo
  </code></pre>
  
  <p>I know I can get a <code>NameValueCollection</code> with <code>HttpUtility.ParseQueryString(s);</code> and then use reflection to get the properties of <code>RegistrationForm</code> and check if the values exists, but I was hoping I could use the actually binding method MVC uses.</p>