1.1 Hello World

Source: Internet
Author: User
Tags microsoft c

Learning a language usually starts from the "Hello World" program. below is the C # version:

Using System;

Class Hello {

Static void Main (){

Console. WriteLine ("Hello World !");

}

}


The "Hello World" program starts with the using command and references the System namespace ).

The namespace provides hierarchical organization of C # programs and class libraries. The namespace contains types and other namespaces. For example, the System namespace contains several types, such as the Console class referenced in the program, and several other namespaces, such as IO and Collections. If you reference a given namespace using the using command, you can use the namespace members unlimitedly. It is because the using command is used that System. Console. WriteLine can be abbreviated as Console. WriteLine.

The Hello class declared in the "Hello World" program has only one member, that is, the method named Main. The Main method is declared with the static modifier. The static method is different from the instance method. The latter uses the keyword "this" to reference a specific object instance. The operation of the static method does not need to reference a specific object. As a convention, the static method of the named Main acts as the entry to the program.

Program output is generated by the WriteLine method of the Console class in the System namespace. This class is provided by the. NET Framework class library. By default, the class library is automatically referenced by the Microsoft C # compiler. Note that C # does not have a separate runtime class library. In fact, the. NET Framework is the C # runtime class library.


This article from the "CSharp development topics" blog, please be sure to keep this source http://cssoffer.blog.51cto.com/7059827/1242388

Related Article

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.