Main 方法是程序的入口点,您将在那里创建对象和调用其他方法。一个 C# 程序中只能有一个入口点。

C# CopyCode image复制代码
class TestClass
{
    static void Main(string[] args)
    {
        // Display the number of command line arguments:
        System.Console.WriteLine(args.Length);
    }
}

Expand 图像概述

Expand 图像本节内容

Expand 图像C# 语言规范

Expand image请参见