Hello World!

“Hello World” is the most common example to teach a programming language. It shows the basic structure and syntax to print the word “Hello World”. This is the first step towards a bigger, interesting and yet challenging world of software development.

using System;

namespace HelloWorld
    class Program
        ///Main entry to the program.
        ///<param name="args">Arguments to be passed.</param>
        static void Main(string[] args)
            //Write to output window
            Console.WriteLine("Hello World!");

Above code shows the most basic structure and syntax in programming C#.

Line 1: Declaration for importing namespaces
Line 3: Namespace of the current assembly
Line 4: Start of namespace
Line 5: Class declaration
Line 6: Start of class
Line 7-10: Describes the type or type member. It is used in automatic documentation and used by Visual Studio IntelliSense to display the description of the said type or type member during development.
Line 11: Method declaration
Line 12: Start of a method
Line 13: Comment – a one line comment. You should always document your source code well.
Line 14: Statement
Line 15: End of method
Line 16: End of class
Line 17: End of namespace


  • statements are terminated with semi-colon ;
  • opening curly bracket { must always have a corresponding closing curly bracket }

Now let’s keep learning and challenging ourselves – and it has just begun.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.