Display text
Let's analyze a program that displays the phrase "
Hello, world!
"
using System;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
Let's take it in order:
using System;
- The
using
directive includes the
System
namespace, which defines the entire C# standard library.
class Program {...}
and
static void Main() {...}
have already been explained in previous tasks.
Console.WriteLine("Hello World!");
- method that displays text in the console window. After it is executed, the cursor moves to the next line.