CSharp Hello Learners


//The following program is a Small Sample of C# Programming...

using System;

namespace TrainingSamples
{
    class Demo01
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello Learners, Welcome to C#");
            Console.Read();
        }
    }
}

/*Output

Hello Learners, Welcome to C#

*/

Points to Learn from this Program

1. Here, system is package / namespace included to support Console class methods WriteLine(), Read().


2. Main() method should be defined inside the class

3. class has to part of a namespace (optional)

4. string[] args is an array to accept command line arguments, when we run this program from the command line after compiling the same using csc.exe of visual studio command prompt.



No comments:

Post a Comment