1.1.3 understand c # program,

Source: Internet
Author: User

1.1.3 understand c # program,

Using System;

Using System. Collections. Generic;

Using System. Linq;

Using System. Text;

Using System. Threading. Tasks;

Namespace HellowWorld

{

Class Program

{

Staticvoid Main (string [] args)

{

Console. WriteLine ("hellow world ");

Console. ReadLine ();

}

}

}

1. namespace keywords

Namespace is a way to organize code in c #. Similar to the package in java, you can put closely related code in the same namespace, greatly improve management and use efficiency

2. using Keyword

Use using in c # To reference other namespaces, similar to using import to import other packages in java

3. class keywords

C # is an object-oriented language like java. class keywords are used to represent classes. The written code should be included in the class, and the class should be included in the namespace. c # is different from java, the class name is not required to be the same as the class file name

4. Main Method

The Main () method in c # is the main gate of the program. The application starts to run from here, which works the same as Main () in java, but Main () in c () the initial letter must be larger.

The Main () return values of c # include void or other values, and the parameters can be optional. There are four forms.

Static void Main (){}

Static int Mian (){}

Sttic void Main (string [] args ){}

Static int Main (string [] args ){}

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.