ideas | discover | explore

Monday, August 22, 2011

C# 1 – Hello World

1.  Go to File -> New -> Project… .
2.  On the left side under Installed Templates select Visual C# -> Windows. On the right side select Console Application. Enter HelloWorld on the Name. Click OK.


3.  In the opened Program.cs file. Look for the part where it says
    static void Main(string[] args)
        {
        }


4.  Enter the following code in between the curly braces “{“ and “}”.
    Console.Write("Hello World Again!");

5.  Your screen will now look like this.


6.  To execute or run your code press F5. You can also press the Play button like the one shown below.
7.  You’re probably wondering what happened when you tried to run the code and you noticed only slight flicker on your screen. The code actually executed very fast that it felt like you never saw the results of the code. Add the following code below on the next line after Console.Write.

8.  Press F5 to run and see the result.

9.  Congratulations! You’ve just run your first program. Take a break for now and enjoy life. Watch out for my next episode.

10.  Thank you.

No comments: