Может быть, что-то вроде этого:
public static class HtmlExtensions
{
public static MvcHtmlString MyTag(this HtmlHelper helper, string tagName, string innerText, Dictionary<string, string> attributes)
{
TagBuilder tag = new TagBuilder(tagName);
tag.SetInnerText(innerText);
tag.MergeAttributes<string, string>(attributes);
return MvcHtmlString.Create(tag.ToString());
}
}
, а затем используйте вид изнутри:
@Html.MyTag("custom", "Text", attributes)