"C #"-Basic knowledge of C #

Source: Internet
Author: User

1. Namespaces:

Usage: (1) Build: Create a namespace, such as T1, syntax format: namespace T1.

(2) Use: Use a namespace, two methods a) using a using directive, such as after building a console application in VS

b) namespace. Class Name. Method Name

Example:

Using T1;namespace consoleapplication1{    class Class1    {        static void Main (string[] args)        {            Zhou Zhou = new Zhou ();            Zhou. Example ();}}}    Namespace t1{    class Zhou    {public        void Example ()        {            Console.WriteLine ("Reference to Namespace");            Console.readkey ();}}}    
2. Main method:

The Main method is the entry point for the program, and a C # program must contain a Main method. There can be only one main method in a C # program. And all the main methods in C # must be static.

In the Zhu Guangming video There is a new class, such as my original class only one Class1 now adds a class Class2 and the settings start from Class2, but the start point is only one and cannot be started from Class2 because the main method is not added in Class2. When you add the main method to Class2, you can set the start from Class1 or Class2. This is the main method function, that is, the program entry point.

3.

"C #"-Basic knowledge of C #

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.