EDIT: It sounds like you want to be able to call this method without any HtmlHelper
object at all.
If the method needs an HtmlHelper
, you will not be able to call it without one.
You should rewrite the method so that it doesn't need an HtmlHelper
.
You can make an overload with fewer parameters:
public static Jquery Extra(this HtmlHelper htmlhelper, string message) {
return htmlHelper.Extra(message, null);
}
In C# 4, you can also use an optional parameter:
public Jquery Extra(this HtmlHelper htmlhelper, string message, IDictionary<string, object> htmlAttributes = null) {
I highly recommend that you also add an overload that takes an anonymous type:
public static Jquery Extra(this HtmlHelper htmlhelper, string message, object htmlAttributes) {
return htmlHelper.Extra(message, null, new RouteValueDictionary(htmlAttributes));
}