When writing the htmlhelper extension, if I want to support similarly structured ctors for my htmlhelper extension method, I use the RouteValueDictionaryfollowing:
public static string ListBoxDict(this HtmlHelper htmlHelper,
string name,
object value,
object htmlAttributes)
{
return ListBoxDict(htmlHelper,
name,
value,
((IDictionary<string, object>)
new RouteValueDictionary(htmlAttributes)));
}
My question really is why I need it RouteValueDictionary... I know you can't just drop it htmlAttributesuntil IDictionary<string, object>... although I'm not sure why it could be where I'm confused. Shouldn't it RouteValueDictionarybe routing, and therefore has nothing to do with the HtmlHelper methods? As I said, I probably skipped this point, so I would be glad if someone could tell me what I missed.
Greeting...
edit: in response to Dan's answer →
I just watched what I saw in the mvc source code for input helpers ...
- . "
src\SystemWebMvc\Mvc\Html\InputExtensions.cs"
:
public static string TextBox(this HtmlHelper htmlHelper,
string name,
object value,
object htmlAttributes)
{
return TextBox(htmlHelper,
name,
value,
new RouteValueDictionary(htmlAttributes))
}
, , ?