The note of learning ASP. NET [8] basic knowledge of C #. NET development by helloworld

Source: Internet
Author: User
May 12   Below is the simple helloworld source code and the source code evolved based on the learning content: Class helloworld

{// Each. NET application must contain one and only one main method, which is the entry to the entire application // and m must be capitalized. Public static void main () {// Here we only output Hello world! System. Console. writeline ("Hello world! ") ;}} Using system; // tell the runtime environment which namespaces and methods should be referenced in this class, however, this does not increase the size of the generated program.

{Public static void main () {// you can see that the previous system. is omitted in the following line of code, and only console. writeline ("Hello world! "); // Writeline () is the method in the console class in the system namespace, in the previous Code instance, we wrote a complete path // to tell the runtime environment where our method can be found. If we only enter the console. writeline () is called, // The runtime environment will be confused, and I don't know where to find this class to call writeline (). There are also many methods in its // class in this namespace. If our namespace name is very long, when writing a program, we need to frequently enter a long complete path to call the method. // This is very troublesome. In this example, we use the using identifier, using system. This line of code tells the runtime environment which namespaces are used in our class, in this way, you can call system without entering the complete namespace + class name + method. console. writeline (); // you only need to enter the console. writeline ("Hello world! "); The console. writeline (" Hello world! ") ;}} Class helloworld

{Public static void main () {// you can see that the code is separated. This way, the compiler does not care about code segmentation, we can separate long code segments // to write our code system more clearly. console. writeline ("Hello world! ");}}

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.