Thursday, 20 December 2012

Use razor comments in MVC views not HTML comments

Make sure for code documentation you use the razor-style comments in your ASP.NET MVC views, not HTML-style comments. Regular HTML comments will be sent to the client which would increase the page size and expose unnecessary implementation details to the end-user, razor comments are kept server-side.

Good:
@* Comment *@

Bad:
<!-- Comment -->