如何在 C# 中編寫“你好,世界”?


若要在 C# 中列印“你好,世界”,請使用 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() 方法顯示了文字“你好,世界”。輸出使用 Console 顯示 −

Console.WriteLine("Hello World");

更新於: 22-Jun-2020

444 次瀏覽

開啟 職業生涯

完成課程以獲得認證

開始
廣告
© . All rights reserved.