C Fundamentals Getting Started Keywords

  • 2021-12-11 08:39:50
  • OfStack

Examples:


using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
 class Program
 {
  static void Main(String[]args)
  {
   Console.WriteLine("Hello World!");
  }
 }
}

1. The keyword class, which is used to declare a class, is the smallest unit of an C # program, such as in the above example, the class name is Program.

2. The keyword namespace, which is used to declare a "namespace." For example, in the above example, the namespace is called MyApp1.

3. The keyword using, which is used to import namespaces. For example, this sentence: using System. Text;; The role is to import classes in the System. Text namespace.

4. The keywords static (static), void (no return value), string (string type). Often seen in the declaration of the Main () method: static void Main (string [] args)

5. The Main () method is a special method in C #, which is the entry point of the program, that is, the program cannot be started without the Main () method.

6. All keywords are composed of lowercase letters. In C #, case is strictly sensitive.

7. Shortcut key-F5 (debug); ctrl + F5 (startup without debugging).

8. Output a one-sentence command: Console. WriteLine ("Hello World! ")


Related articles: