摘要:C# 第一支程式,Hello World!
To write the C# program, type " hello.cs" and type (in the notepad)
請用記事本撰寫下列程式碼並存成檔名hello.cs 並學會如何執行與編譯
dos模式下,在C:\Windows\Microsoft.NET\Framework\v2.0.50727 路徑下,編譯hello.cs
假設hello.cs檔案放在C槽內
指令:
csc /out:c:\hello.exe c:\hello.cs
out:第一個路徑是指檔案編譯要輸出到哪,第二個路徑是指原本檔案放在哪。
程式碼:
using System;
public class Hello
{
public static void Main()
{
Console.WriteLine("Hello World !!");
}
}