.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> C# >> Post New Resource Bookmark and Share   

 Subscribe to Articles

C# Comments

Posted By:Shashi Ray       Posted Date: February 19, 2009    Points: 10    Category: C#    URL: http://www.dotnetspark.com  
 

C# Comments

 

As you have already seen, comments in C# start with a double forward slash and continue to the end of the current line. C# also recognizes Cstyle comments which begin with /* and continue through any number of lines until the */ symbols are found.

 

//C# single-line comment

/*other C# comment style*/

/* also can go on

for any number of lines*/

 

You can't nest C# comments; once a comment begins in one style it continues until that style concludes.

 

Your initial reaction as you are learning a new language may be to ignore comments, but they are just as important at the outset as they are later. A program never gets commented at all unless you do it as you write it, and if you ever want to use that code again, you'll find it very helpful to have some comments to help you in deciphering what you meant for it to do.

 

For this reason, many programming instructors refuse to accept programs that are not thoroughly commented.

 

Shashi Ray


 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend