Wednesday, 29 October 2014

Comments



There are two major types of comment in visual C#.
1.   // pronounced double slash comment used for a single line of code.
2.   /*   */ pronounced slash star comment used for multi lines of code. The comment begins with /* and end with */.
You may ask what effect comments have on my application.
Like I said earlier on, comments make you to remember the meaning of your code. That is, it is only useful to you – the programmer. Any where you put the comment sign the compiler will bye-pass the code. Let’s look at the use of comments.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace helloworld
{
    class Program
    {
        // simple program to show hello world
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World");
        }
    }
}
The above code is the use of slash slash(//) comment


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace helloworld
{
    class Program
    {
        /* simple program to show hello world
         *i am happy
         *i have started my c# tutorial.
         *so so interesting
         */
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World");
        }
    }
}

The above code is the use of star slash(/*) comment

No comments :

Post a Comment