title: Convert a NameValueCollection to a dynamic object
body: <p>I am trying to take a FormCollection passed to my ASP.NET MVC Controller and convert it to a dynamic object, which is then serialized as Json and passed to my Web API.</p>
  
  <pre><code>    [HttpPost]
      public ActionResult Create(FormCollection form)
      {
          var api = new MyApiClient(new MyApiClientSettings());
  
          dynamic data = new ExpandoObject();
  
          this.CopyProperties(form, data); // I would like to replace this with just converting the NameValueCollection to a dynamic
  
          var result = api.Post("customer", data);
  
          if (result.Success)
              return RedirectToAction("Index", "Customer", new { id = result.Response.CustomerId });
  
          ViewBag.Result = result;
  
          return View();
      }
  
      private void CopyProperties(NameValueCollection source, dynamic destination)
      {
          destination.Name = source["Name"];
          destination.ReferenceCode = source["ReferenceCode"];
      }
  </code></pre>
  
  <p>I've seen examples converting a dynamic object to a Dictionary or NameValueValueCollection, but need to go the other way. </p>
  
  <p>Any help would be appreciated.</p>