I want to use a string variable which could contain the values h1, h2, h3 etc to build some html. This works fine for the opening tag, but does not work nicely for the closing tag. If I write
@{ var tag = "h1" ; }
<@tag>some title here</@tag>
I end up with the html
<h1>some title here</@h1>
A work-around which seems to work is
<@tag>some title here<@("/"+tag)>
but it's pretty ugly. Is there some escape sequence I need to use here?
@Html.MyCustomTag("h1", "some title here")usingTagBuilder?