Hello world in C#



Understanding C# program’s basic anatomy

In this section, we write ‘Hello World’ program using C#.

Writing ‘Hello World’ as a console application
Here, we will create a very small console application. This application will show “Hello World”
into the console (display terminal).
Steps:
1. Start Microsoft Visual Studio 2013
2. Click File>New>Project or, Shortcut Ctrl+Shift+N
You will see the following window.


Figure: New Project Creation Templates

3. Select Windows>Console Application
4. Write appropriate name in ‘Name’ box, change the location of your project directory by
clicking the ‘Browse’ button
5. Click ‘Ok’ button
6. You will see the following code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WalkThrough1
{
class Program
{
static void Main(string[] args)
{
}
}
}

7. Now write the following code snippet inside the main method

Console.WriteLine("Hello world");
Console.ReadKey();

8. Now Press F5 or Click on the Debug button

9. You will see the output ..


Post a Comment

Previous Post Next Post