Consider the following ASP.NET MVC razor view snippet which defines a helper
@helper FieldFor<TModel>(Expression<Func<TModel, string>> expression)
{
<div class="form-group">
@Html.LabelFor(expression,
htmlAttributes:
new {@class = "control-label col-md-2"})
<div class="col-md-10">
@Html.EditorFor(expression,
new
{
htmlAttributes =
new {@class = "form-control"}
})
@Html.ValidationMessageFor(expression, "",
new {@class = "text-danger"})
</div>
</div>
}
What is the pattern to convert it to a method of a class similiar to:
public static MvcHtmlString FieldFor(this HtmlHelper helper, FieldFor<TModel>(Expression<Func<TModel, string>> expression))
{
/* Method */
}
All the examples I have found focus on generating markup which doesn't rely on other HTML helpers.