Add square brackets right after the code block

I wonder how I can add []

(string) right after the function call

something like

@Html.ActionLink("x", "y")[]

      

I tried this, but it results in a compilation error as the parenthesis is treated as an index operator

I want the html result to be like

<a ....>...</a>[]

      

+3


source to share


1 answer


You can use parentheses to indicate that in an expression:



@(Html.ActionLink("x", "y"))[]

      

+2


source







All Articles