1. Download and install Visual Studio. Visual Studio can be downloaded from VisualStudio.com. The Community edition is suggested, first because it is free, and second because it involves all the general features and can be extended further.

  2. Open Visual Studio.

  3. Welcome. Go to File → New** → Project**.

    http://i.stack.imgur.com/fpvTX.png

  4. Click TemplatesVisual C#Console Application

http://i.stack.imgur.com/kKGls.png

  1. After selecting Console Application, Enter a name for your project, and a location to save and press OK. Don’t worry about the Solution name.
  2. Project created. The newly created project will look similar to:

http://i.stack.imgur.com/WVkeF.png

(Always use descriptive names for projects so that they can easily be distinguished from other projects. It is recommended not to use spaces in project or class name.)

  1. Write code. You can now update your Program.cs to present “Hello world!” to the user.
using System;
    
    namespace ConsoleApplication1
    {
        public class Program
        {
            public static void Main(string[] args)
            {
            }
        }
    }

Add the following two lines to the public static void Main(string[] args) object in Program.cs: (make sure it's inside the braces)

Console.WriteLine("Hello world!");
Console.Read();

Why Console.Read()? The first line prints out the text "Hello world!" to the console, and the second line waits for a single character to be entered; in effect, this causes the program to pause execution so that you're able to see the output while debugging. Without Console.Read();, when you start debugging the application it will just print "Hello world!" to the console and then immediately close. Your code window should now look like the following:

using System;

namespace ConsoleApplication1
{
    public class Program
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello world!");
            Console.Read();
        }
    }
}
  1. Debug your program. Press the Start Button on the toolbar near the top of the window or press F5 on your keyboard to run your application. If the button is not present, you can run the program from the top menu: Debug → Start Debugging. The program will compile and then open a console window. It should look similar to the following screenshot:

https://i.stack.imgur.com/odDu6.png

http://i.stack.imgur.com/ZD5MF.png

  1. Stop the program. To close the program, just press any key on your keyboard. The Console.Read() we added was for this same purpose. Another way to close the program is by going to the menu where the Start button was, and clicking on the Stop button.