The first program in almost no programming language is called "Hello, World," so create a HelloWorld program in Visual Studio first.
The details of each section are as follows:
The Main method is the starting point for the program to run, and the most important code is written in curly braces behind the main method. There are two commands in the main method, and they end with a semicolon. The function of the first command is to print the contents between the double quotation marks. The second command is to be able to see the results at the terminal when debugging. Or you can see the results by using the Ctrl+f5 shortcut key to let the program run without debugging.
Speaking of other code,namespace defines a namespace , where Firstapp is a namespace. The class below is the one in C # , and program is a class.
Why is there such a layer of stuff in C #? These are the frameworks that C # applications should have,class is the smallest unit of C # programs , and C # programs consist of a single class. namespaces, in effect, are used to organize and manage classes, and a namespace can contain multiple classes. When we write the program, there will be a lot of classes that Microsoft has written, integrated in Visual Studio, can provide us with direct use. This can reduce the amount of code. For example, the beginning of a program using ... is to import the namespaces provided by Microsoft to facilitate the use of the classes. The keyword using is followed by the name of the namespace. We don't need to remember it now, it's what Visual Studio automatically provides, and we need to use it.
Knowledge Points:
The x namespace contains several classes
The x class is the smallest unit of C #
x The Main method is the entry of the program
x Print a session of the Command Console.Write ():
Tips
When you open Visual Studio, if you do not like font size and code color, you can select "Tools---options---fonts and colors" in the menu bar to modify the results to your satisfaction.
By:young_wind
2016-09-08
1.3 First C # program