How-to: Comments in ASP.NET

July 23rd, 2008 Posted in ASP.NET, Programming

When you create pages in ASP.NET - you must understand what you write. Comments help you write clean and clear code. Comments are the very important instrument of programmer. At the correct use of comments - his code is always clear a programmer and he can change him not reflecting.
Distinguish comments on the server-side and comments which are added to the outgoing HTML file.

If you want to write a comment which will be represented only inwardly aspx pages, and will not be visible an end user, use such syntax:


<%--
This is the server-side comment
--%>

Text “This is the server-side comment” be accessible only in server side.
If you want that the visitors of site saw comments in the source code of HTML of page use such code:

<!-- comment -->

I hope that this little example showed as it is easily possible to document a code as on the side of server (at development of site) so on the side of visitor (to view of HTML of pages).

Leave a Reply

You must be logged in to post a comment.