12.10.1 Getting started with Haxe/C#

Haxe can be used as a language for .NET platform through its C# target. Let's make a basic program using .NET Console class:

/**
    Multi-line comments for documentation.
**/
class Main {
    static public function main():Void {
        // Single line comment
        trace("Hello World");
    }
}

To compile Haxe to C# we need two obvious prerequisites installed:

After that we can compile to C# using the --cs option from either the command line or an hxml-file:

haxe --cs out --main Main

The compiler will output C# sources into out/src folder, then call C# compiler to build Main.exe file into out/bin folder.

More information