所有語言的第一個程式, Hello World
來點不一樣的, Hello C#, :)

using System;
using System.Collections.Generic;
using System.Text;

namespace Hello1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello, C#");
        }
    }
}

說明:
1. Main 方法是程式的進入點,程式控制會在此開始和結束。
    Main method 必須在類別或結構中宣告。它必須為靜態且不應該為 public
    傳回型別可以是 void 或 int。
2. WriteLine method 屬於 System.Console class, 用來將資料顯示在 console 中.

程式碼其實可以更簡潔一點, 只是用Visual Studio產生專案時, 會加了一堆東西

arrow
arrow
    文章標籤
    C#
    全站熱搜

    mark528 發表在 痞客邦 留言(0) 人氣()