Thursday, February 10, 2011

Comment in C Sharp

بسم الله الر حمن الر حيم

          First, If you were asked about how to provide comments in C #, how would you answer it?
Perhaps you will say: please see the help file,or for those of you who are used to using this language, you surely know the answer. Yes, the answer must use the characters / / to one paragraph and / ** / for a few paragraphs...

          Yupz, way to comment on the language C # is almost similar to the way to comment to Delphi, this is because the designers of C # are the same people when designing Delphi, Anders Hejlsberg name. Previously he worked at Borland for Delphi design, but now he was at Microsoft to design and develop C # language

So, how to comment on the language C # is:

A multiline comment

  1. This type of comment must begin with /* and end with */.
  2. Anything between these two comment symbols is ignored by the compiler.

Example:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace Matematika.Itu.Gampang
{
    class Program
    {
        static void Main(string[] args)
        {
            /*
             * This is multiline comments
             * Begin with /* and
             * Ending with */
            */
            a = 30.0;
            b = 45.0;
            c = 60.0;
            d = 90.0;
 
            
            System.Console.WriteLine("Berikut ini adalah sudut-sudut istimewa: ");
            System.Console.WriteLine("a = " + a + " Derajat");
            System.Console.WriteLine("b = " + b + " Derajat");
            System.Console.WriteLine("c = " + c + " Derajat");
            System.Console.WriteLine("d = " + d + " Derajat");
            System.Console.WriteLine("");
        }
    }
}

single-line comment



  1. A single-line comment begins with a // and ends at the end of the line.


  2. Programmers use multiline comments for longer remarks and single-line comments for brief, line-by-line descriptions.

Example:



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace Matematika.Itu.Gampang
{
    class Program
    {
        static void Main(string[] args)
        {
            // This is a single comment
            a = 30.0;
            b = 45.0;
            c = 60.0;
            d = 90.0;
 
            
            System.Console.WriteLine("Berikut ini adalah sudut-sudut istimewa: ");
            System.Console.WriteLine("a = " + a + " Derajat");
            System.Console.WriteLine("b = " + b + " Derajat");
            System.Console.WriteLine("c = " + c + " Derajat");
            System.Console.WriteLine("d = " + d + " Derajat");
            System.Console.WriteLine("");
        }
    }
}



Alhamdulillah, Hopefully helpful,,,

No comments:

Post a Comment