.NET Framework是一组库和运行时,最初由Microsoft设计。所有.NET程序都编译为称为Microsoft中间语言(MSIL)的字节码。 MSIL由公共语言运行时(CLR)运行。
您可以在下面找到支持.NET Framework的各种语言的“Hello World”示例。 “Hello World”是在显示设备上显示“Hello World”的程序。它用于说明构建工作程序的基本语法。它还可以用作健全性测试,以确保语言的编译器,开发环境和运行时环境都能正常工作。
版 | 发布日期 |
---|---|
1.0 | 2002年2月13日 |
1.1 | 2003-04-24 |
2.0 | 2005-11-07 |
3.0 | 2006-11-06 |
3.5 | 2007-11-19 |
3.5 SP1 | 2008-08-11 |
4 | 2010-04-12 |
4.5 | 2012-08-15 |
4.5.1 | 二〇一三年十月十七日 |
4.5.2 | 2014年5月5日 |
4.6 | 2015-07-20 |
4.6.1 | 二〇一五年十一月十七日 |
4.6.2 | 2016年8月2日 |
4.7 | 2017年4月5日 |
版 | 发布日期 |
---|---|
1.0 | 2000-01-01 |
2.0 | 2005-10-01 |
3.5 | 2007-11-19 |
3.7 | 2009-01-01 |
3.9 | 2013年6月1日 |
版 | 发布日期 |
---|---|
4.2 | 2011-10-04 |
4.3 | 2012年12月4日 |
4.4 | 2015年10月20日 |
print "Hello World"
using System;
class Program
{
// The Main() function is the first function to be executed in a program
static void Main()
{
// Write the string "Hello World to the standard out
Console.WriteLine("Hello World");
}
}
Console.WriteLine
有几个重载。在这种情况下,字符串“Hello World”是参数,它将在执行期间将“Hello World”输出到标准输出流。其他重载可能会在写入流之前调用参数的.ToString
。有关更多信息,请参阅.NET Framework文档 。
using namespace System;
int main(array<String^>^ args)
{
Console::WriteLine("Hello World");
}
open System
[<EntryPoint>]
let main argv =
printfn "Hello World"
0
.class public auto ansi beforefieldinit Program
extends [mscorlib]System.Object
{
.method public hidebysig static void Main() cil managed
{
.maxstack 8
IL_0000: nop
IL_0001: ldstr "Hello World"
IL_0006: call void [mscorlib]System.Console::WriteLine(string)
IL_000b: nop
IL_000c: ret
}
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
}
}
System.Console.WriteLine("Hello World");
namespace HelloWorld;
interface
type
App = class
public
class method Main(args: array of String);
end;
implementation
class method App.Main(args: array of String);
begin
Console.WriteLine('Hello World');
end;
end.
Write-Host "Hello World"
print "Hello World"
import clr
from System import Console
Console.WriteLine("Hello World")
Imports System
Module Program
Public Sub Main()
Console.WriteLine("Hello World")
End Sub
End Module