如何在 C# 中編寫“Hello World”?


若要在 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");

更新於: 2020 年 6 月 22 日

444 次瀏覽

開啟你的職業生涯

完成課程並獲得認證

開始學習
廣告
© . All rights reserved.