C# Hello World

1. Create a new console application project by selecting File New Project in VS or File New Project in Visual Studio
2. Select down Visual C# from left menu and then Console Application.
3. Give your Project a name, Press ok
4. program.cs already created by default. Write following code in file program.cs

Example

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("hello world");
            Console.ReadKey();
        }
    }
}

5. Press F5 or select Debud > Start Debugging from file menu to see the result.
 
Console applications terminate as soon as they finish execution, which can mean that you don ’ t get a chance to see the results if you run them directly through the IDE. To get around this in the preceding example, the code is told to wait for a key press before terminating, using the following line:

Console.ReadKey();