The first program to compile is the traditional "Hello, World!". It is a console application that displays the "Hello, World!" message.
using System;
class HelloWorld
{
static void Main()
{
Console.WriteLine("Hello, world!");
}
}
The compiler creates HelloWorld.exe and the Build pane reports on the compilation. Once the application has been generated, the Run button becomes enabled.
You just compiled and run your first C# program! But what happened? HelloWorld.exe is a console application, so it displayed the "Hello, World!" message for a fleeting moment and shut down, without giving you the time to examine the output. You can circumvent this by opening a DOS window and running the program from the command line, but Antechinus has a nice learning feature that allows you to run the program through a console.
The program runs again and closes down, but the "Hello, World!" message
is captured in the Editor's Output pane.
Note: To use Run through Console your program
can only have text output. Pausing to solicit input from users would cause the
editor to freeze, and you would have to press Ctrl-Alt-Delete to close it down.
For such programs use Run instead.