Computer >> Máy Tính >  >> Lập trình >> C#

Làm thế nào để viết Hello World trong C #?

Để in “Hello World” trong C #, hãy sử dụng Console.WriteLine.

Hãy để chúng tôi xem một chương trình C # cơ bản để hiển thị văn bản -

Ví dụ

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

namespace Program {
   class MyApplication {
      static void Main(string[] args) {
         Console.WriteLine("Hello World");
         Console.Read();
      }
   }
}

Đầu ra

Hello World

Ở trên, chúng tôi đã hiển thị văn bản “Hello World” bằng phương thức WriteLine (). Đầu ra được hiển thị bằng Bảng điều khiển -

Console.WriteLine("Hello World");