C#主函数

2025-05-15 21:20:18
推荐回答(3个)
回答1:

//athlongyj的解答不完全正确,Main应该包含在一个类当中,并且整个程序只能有
//一个Main函数,且要是static型的,而且M要大写.正确的如下:
using System;
using System.Collections.Generic;
using System.Text;

namespace HelloWorld
{
class Program //Main要包含在类当中
{
static void Main(string[] args)
{
}
}
}

回答2:

///


/// 应用程序的主入口点。
///

[STAThread]
static void Main()
{
Application.Run(new Form1());
}

回答3:

同意楼上,在C#中,一切东西都是属于类的。