table of Contents
The first program of C # Hello World!
Manually compile
HelloWorld under .Net Core
Use Visual Studio 2019
Create a project
CREATE THE APPLICATION
Run application
Close application
The first program of C # Hello World!
/ *
* C #'s first program Hello World!
*
* HelloWorld.cs
*
* /
Using system;
Class helloworld {
Public static void main () {
Console.writeline ("Hello World!");
}
}
Manually compile
Command line compilation:
CSC Hello.cs
Run Hello.exe:
./Hello Hello, World
HelloWorld under .Net Core
Create a console project
DOTNET New Console -o Hello
After the creation is the default is a Hello World's console program, and the project directory is directly running:
CD Hello
DOTNET RUN
Use Visual Studio 2019
Create a project
Open ISUAL Studio 2019. Select Create a New Project in the Start Window. Enter Console in the search box of the Create A New Project window. Then select C # in the language list, then select Windows in the platform list. Select the Console App (.Net Core) template in the filtered result, click Next. In the Configure your New Project window, Project Name enters HelloWorld, click Create. Visual Studio Opens a new project.
CREATE THE Application
The Visual Studio project contains a default Hello World "code.
Press F5 to enter the debug mode. However, the console window will pass.
Add some code:
We add some code to let the program turn off after the transfer is transferred.
Add the following code immediately after calling the WriteLine method: console.readline ();
Checking your code is as follows:
Run application
Click HelloWorld on the toolbar to run (or press F5) to view programs in the console window.
Close application
Knocking Enter close black window. Close the Output panel of VS. Turn off Visual Studio.