Link Search Menu Expand Document

ad


Create a console application

  • Open Visual Studio

  • On the start window, choose Create a new project

  • On the Create a new project window, enter console in the search box.

  • Next, choose C# from the Language list, and then choose Windows from the Platform list

  • After you apply the language and platform filters, choose the Console App (.NET Core) template, and then choose Next

Img

  • In the Configure your new project window, type or enter HelloWorld in the Project name box.

  • Select a folder to store the project. Then, choose Create.

Img

The application code

In the code editor, you will see the following C# code:

using System;

namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
        }
    }
}

The code will write a line of text, ‘Hello World’, in the console window.

Run the application

  • In the top menu, look for the HelloWorld application with a green play button and click it to run the application.

  • Ensure the application is set to run in ‘Debug’ mode.

Img

  • View the result of your application code in the console window.

Img

  • Close the console window when you are done.

Bob Tabor Videos

Courtesy Microsoft and Bob Tabor


NOTE - These videos are a little dated, Visual Studio 2013/2015 is being used here. However, the principles are basically the same.


Creating Your First C# Programme


Understanding Your First C# Programme


ad



Copyright © 2020 Ray Consulting Limited - Coding Skills.IO.