First let’s look at the environment. I’m going to introduce you directly to the.net Core environment. Core is actually much simpler than framework.
First: essential for entry. The first program to start. HelloWorld
Use console to create our first.net Core project HelloWorld: blog.csdn.net/qq_36051316…
We need to see the following linked articles to build the environment above.
Download.net Core and install: blog.csdn.net/qq_36051316…
Once we learn how to use the console, we need to learn how to use the development tools. I recommend vscode here
Create.net Core console applications with VS Code: blog.csdn.net/qq_36051316…
———- gorgeous dividing line ———-
.net Core is also available for those using Deepin-Linux: blog.csdn.net/qq_36051316… Other installation and use will go to the official website.
———- gorgeous dividing line ———-
Let’s talk about two important starting points in C#.
Namespace: namespace class: class
1. Main method
Formally, the class that defines the Main method is called an application object. While an executable can have multiple application objects (which can be useful when performing unit tests), However, we must inform the compiler of which Main method to use as the entry point either through the command line compiler’s /Main option or through the Startup Object drop-down box in the Application TAB of the vs project properties edit — mastering C#, p. 55
This method is called the program entry, and it is a static method. Those of us who are new to programming can write something new that we’ve learned.
2, the Console
This class is our most basic class production documentation or continue to read the following article: docs.microsoft.com/zh-cn/dotne…
There are five common methods of the console class in.NET Core: ReadKey // captures a word input. ReadLine // captures a line input. Write // outputs only without line newlines
using System; Namespace _20190316LBy1 {class Program {static void Main(string[] args) {console. Write(" friendly notes: "); Console.WriteLine(" Please enter one sentence "); string str1 = Console.ReadLine(); // The captured text is put into a variable console. WriteLine(" What you typed is: "+ str1); }}}Copy the code
Welcome to qq group communication: 704028989