I would like to group my html helper so that I could write in my view something simple as this:
@Html.SubGroup.MyCustomHelper("Hellow World")
instead of:
@Html.MyCustomHelper("Hellow World")
It appears that I cannot nest static classes in HtmlExtensions class that I use for all my helpers.
Any advices?
You can’t do
@Html.SubGroup.MyCustomHelper("...")because there’s no such thing as an “extension property” and you don’t control theHtmlHelperstatic class.But you could do
@Html.SubGroup().MyCustomHelper("...")with the extra parens as an extension method.