In ASP.NET RAZOR MVC5 there is such a great helper as
Html.BeginForm() It can be written as
@Html.BeginForm() ... @Html.EndForm() So and
@using (Html.BeginForm()) { ... } How to create a custom helper on this principle. For example, I need a div block, the block is not bare, but there are some basic elements in it, let's say five links. I need to duplicate this block all the time, in addition to the fixed five links, I need to push a bunch of other elements inside, it could be a button / table / picture / etc. So, how can this be implemented using the same beautiful curly braces, rather than writing Html.MyPerfectDivStart () and Html.MyPerfectDivEnd ()
There is an option to use MvcHtmlString and pass as a List<MvcHtmlString> parameter from various other components created by me. But it looks ugly!
@using, and the closing@using- in Dispose. You know that using is syntactic sugar? - AK ♦