Hello world in C#

// A Hello World! program in C#
using System;
namespace HelloWorld
{
    class Hello
    {
        static void Main()
        {
            System.Console.WriteLine(“Hello World!”);

            // Keep the console window open in debug mode.
            System.Console.WriteLine(“Press any key to exit.”);
            System.Console.ReadKey();
        }
    }
}

Here the first line starts with the // sign which indicates that the line is comment and has nothing to do with the programming. This comment helps you to understand what your code is so that in future if you see the code it would not be hard for you to understand what you have written. The Second line ‘using system;’indicates the namespaces that your program must have in order to access the functions. As being the object oriented programming the concept of class must be understood. And lastly there is the void main() function which is invoked as soon as the program is launched. and there you can see the ‘writeline()’ function which consists of the text hello world in it, that means this line of code writes the hello world to the console screen. The last line code which is readkey() reads the key entered by the user. That is all you have to understand about the starting program of hello world. Happy C#ing.

Leave a Reply

Your email address will not be published. Required fields are marked *

How to whitelist website on AdBlocker?

How to whitelist website on AdBlocker?

  1. 1 Click on the AdBlock Plus icon on the top right corner of your browser
  2. 2 Click on "Enabled on this site" from the AdBlock Plus option
  3. 3 Refresh the page and start browsing the site
%d bloggers like this: