C# COMMENTS

 What is C# Comments ?

              Comments can be used to explain C# code , and to make it more readable .It can also be used to prevent execution when testing alternative code .


Two types of C# Comments : 

               * C# Single -line comments

               * C# Multi - line comments 


C# Single -line comments : 

                  * Single -line comments start with two forward slashes ( // ) .

                  * Any text between // and the end of the line is ignored by C#  (will not be executed)

                  The example uses a single -line comment before a line of code :

       


         
       

 C# Multi - line comment :

                      * Multi - line comments start with /* and ends with */ .
                       
                        * Any text between / * and */ will be ignored by C# .
                       

                      The example uses a Multi - line comment ( a comment block ) to explain the code :


                      
             




NOTE :

            Single or Multi - line comment : 
     
                     It is up to you which you want to use . Normally , we use // for short comments , and /* */ for longer.


          
     

Post a Comment

Previous Post Next Post

نموذج الاتصال