Creating a new program using Mono

suggest change

Mono is available for Mac OS X, Windows and Linux.

Install Mono by following installation instructions.

Createt HelloWorld.cs file with the following content:

public class Program
{
    public static void Main()
    {
        System.Console.WriteLine("Hello, world!");
        System.Console.WriteLine("Press any key to exit..");
        System.Console.Read();
    }
}

If you are using Windows, run the Mono Command Prompt which is included in the Mono installation and ensures that the necessary environment variables are set. If on Mac or Linux, open a new terminal.

To compile the newly created file, run the following command in the directory containing HelloWorld.cs:

mcs -out:HelloWorld.exe HelloWorld.cs

The resulting HelloWorld.exe can then be executed with:

mono HelloWorld.exe

which will produce the output:

Hello, world!   
Press any key to exit..

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Getting Started With C#:
* Creating a new program using Mono

Table Of Contents
0 Getting Started With C#
17 Regex
19 Arrays
21 Enum
22 Tuples
24 GUID
27 Looping
36 Casting
46 Methods
88 Events
92 Structs
104 Indexer
106 Stream
107 Timers
109 Threading
127 Caching
135 Pointers
147 C# Script