Comments in Razor

I found out by accident today that you can create comment blocks in Razor like this: @* enter your comment *@

For example if you put this in your view:

<div>
@*
<span>@Model.ToString()</span>
*@
</div>

Your HTML will look like this:

<div>

</div>
Advertisement