1.3 First C # program

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.