C # 8.0 and Net core 3.0 advanced programming sharing note 1: getting started with c#8.0 and net core 3.0


In the process of learning c# related knowledge, we use Visual Studio code to get started with the whole c#.

1、 Installing the visual studio core environment

adopt https://code.visualstudio.com/Download Download and install visual studio code.

The place where I rent a house is equipped with a telecommunications network. It is found that GitHub cannot be accessed and visual studio code cannot be downloaded.

1) Download Visual Studio

If it cannot be downloaded, replace the az764295 of the first download link vo. msecnd. Net is vscode cnd. azure. Cn can be downloaded.



2) Download and install the net core SDK from the following link: https://www.microsoft.com/net/download

3) Start visual studio code, search for c# and install in view = “extensions” in the menu.

Additional extended information:

extend explain
C# for Visual Studio Code ms-vscode.csharp Provide editing support for C #, including syntax highlighting, IntelliSense, go to definition, find all references, debugging support for the desired net core (coreclr), and support for poject in windows, MacOS and Linux JSON and Csproj project support.
C# XML Documentation Comments k-kato.docomment  Produce XML document comments for visual studio code
C# Extensions jchannoncsharpextensions   Add c# classes, add c# interfaces, add fields and properties from constructors, and add constructors from properties
REST Client humao。rest-client Send an HTTP request and view the response directly in Visual Studio code
ILSpy.NET Decompiler icsharpcode.ilspy-vscode Decompile MSIL assembly – support Net framework Net core and NET Standard
SharpPad jmazouri.sharppad It can easily check the results of the code, and the working principle is similar to that of independent tools, such as linqpad and Roslyn pad

2、 Understand relevant knowledge

1) The c# compiler (named Roslyn) that understands the intermediate language dotnet cli tool converts the c# source code into intermediate language (IL) code and stores the IL in the assembly (DLL or EXE file). IL code statements are like assembly language instructions, which are written by Net core virtual machine coreclr execution.

At runtime, coreclr loads IL code from the assembly, and then the IL code is compiled into the machine CPU instructions by the just in time (JIT) compiler, and finally executed by the CPU on the machine. The advantage of the above compilation process is that Microsoft can create CLR for Linux, MacOS and windows. Due to the second compilation process, the same IL code will run everywhere, which will generate code for the local operating system and CPU instruction set.

No matter what language the source code is written in, such as C # or visual basic or F #, all Net applications use IL code for instructions stored in assemblies. Using disassembly tools provided by Microsoft and other companies (such as. Net decompiler ilspy) can open assemblies and display IL code.

2) Yes NET Native

. net native is used to compile c# code ahead of time (AOT) into the CPU instruction of the cost machine, instead of compiling IL code with CLR, and then compiling it into local code in real time. Net native improves execution speed and reduces application memory consumption because native code is generated at build time and then deployed instead of IL code.

For more information Net native information: https://github.com/dotnet/corert/blob/master/Documentation/intro-to-corert.md 。

3、 Writing code using Visual Studio code

Now let’s start writing the code: note that after installing the c# plug-in, you need to restart visual studio code to create the project correctly

1) Start visual studio code.

2) Click file = “open folder” successively.

3) In the open dialog box, navigate to the directory where you want to store the project.

4) Click the new folder button and name the folder code.

5) In the code folder, create a new folder named chapter01.

6) In the chapter01 folder, create a new folder named hellocs.

7) Select the hellocs folder and click Select folder.

8) Navigate to view = “terminal”.

9) Enter dotnet new console at the terminal.

10) After execution, we see that the dotnet command-line tool creates a new console application project in the current folder, and the resource manager shows the creation of two files hellocs Csproj and program cs。

11) Double click program on the left CS file. If you do not need to download and install c# dependencies when installing c# extensions, visual studio code will prompt you to download and install them, such as omnisharp, razor language server and net core debugger.


12) If this warning appears, click Yes. After a while, a message named Vscode folder, which will be used during debugging.

13) We modify the program Console in CS WriteLine(“Hello World!”); Modify to console WriteLine(“Hello C#!”);

14) Navigate to file = to start auto save.

15) Navigate to view = “terminal” and enter dotnet run for execution. We see the console output Hello c#!


ask for help

1) Read Microsoft documentation


2) Get help with the dotnet tool

Enter dotnet help new at the terminal

At the command line, enter dotnet new console – H

3) Use F12 on the variable type to jump to the definition of the class.


I created a c# related communication group. For sharing learning materials and discussing problems. Welcome interested partners: QQ group: 542633085

Recommended Today

Principle of optical motion capture system

Nokov measurement optical motion capture system is a motion capture system based on the principle of infrared optics. Compared with the positioning means such as inertial principle motion capture system and GPS positioning system, it has the characteristics of high precision, low delay, strong real-time performance and is mostly used in indoor scenes. The system […]