代码实现
C#
// Define the namespace
using System;
namespace HelloWorld
{
// Define the class
class Program
{
// Program entry point
static void Main(string[] args)
{
// Output Hello World
Console.WriteLine("Hello, World!");
}
}
}C# Hello World示例,C#是微软开发的面向对象语言,常用于Windows应用和Unity游戏开发
#入门
片段说明
运行说明
- 安装.NET SDK(可从dotnet.microsoft.com下载)
- 将代码保存为HelloWorld.cs
- 编译:csc HelloWorld.cs
- 运行:在Windows上是HelloWorld.exe,在Linux/macOS上是./HelloWorld
或者使用.NET CLI:
- dotnet new console -n HelloWorld
- cd HelloWorld
- dotnet run
常见问题 (2)
推荐代码片段
评论
加载中...