title: MVC - Convert an IDictionary or RouteValueDictionary to object htmlAttributes
body: <p>I've created a HTML Helper Extension which calls a Editor Template Partial View (MyView) in MVC. </p>
  
  <p>I'm passing additional HTML attributes to the HTML Helper Extension via the object htmlAttributes parameter. In the HTML Helper Extension the The htmlAttributes are converted to an RouteValueCollection (could use IDictionary here) and stored in the ModelProperty object:</p>
  
  <pre><code>public static MvcHtmlString TextBoxFor(this HtmlHelper html, ModelProperty prop, object htmlAttributes)
  {
      prop.ControlHtmlAttributes = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes);
      return PartialExtensions.Partial(html, "MyView", prop);
  }
  </code></pre>
  
  <p>In the 'MyView' Partial View I want to render the control and with the passed HTML attributes so I call:</p>
  
  <pre><code>Html.TextArea(Model.ControlName, Model.Value, Model.ControlHtmlAttributes);
  </code></pre>
  
  <p>Howvever this dosnt work because the 3rd parameter should be 'object htmlAttributes' how to I convert the Model.ControlHtmlAttributes to object htmlAttibutes?</p>