Home  >  Article  >  Backend Development  >  Introduction to C# Basics-Introduction to Keywords

Introduction to C# Basics-Introduction to Keywords

黄舟
黄舟Original
2017-03-17 11:52:361931browse

This article mainly introduces C# basic knowledge-keyword related knowledge, which has a very good reference value. Let’s take a look at it with the editor.

Example:

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 is used to declare a class, which is the smallest unit of a C# program. For example, in the above example, the class name is Program.

2. Keyword namespace, the purpose of this keyword is to declare "namespace". For example, in the above example, the namespace is called MyApp1.

3. Keyword using, the purpose of this keyword is to import the namespace. For example, this sentence: using System.Text; is used to import classes in the System.Text namespace.

4. 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# and is the entry point of the program. That is to say, without the Main () method, the program cannot be started.

6. All keywords are composed of lowercase letters. In the C# language, uppercase and lowercase letters are strictly distinguished.

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

8. Command to output one sentence: Console.WriteLine("Hello World!")

The above is the detailed content of Introduction to C# Basics-Introduction to Keywords. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn