如何在 C# 中编写"Hello World"?
csharpprogrammingserver side programming更新于 2025/7/12 7:07:17
要在 C# 中打印"Hello World",请使用 Console.WriteLine。
让我们看一个显示文本"减号"的基本 C# 程序。
示例
using System;
using System.Collections.Generic;
using System.Text;
namespace Program {
class MyApplication {
static void Main(string[] args) {
Console.WriteLine("Hello World");
Console.Read();
}
}
}
输出
Hello World
上面,我们使用 WriteLine() 方法显示了文本"Hello World"。输出使用 Console 显示 −
Console.WriteLine("Hello World");

