Hello world

This is a classic Hello World, if you are using Windows then there should be included with it .net, which has the .net runtime environment (this is stored in C:\WINDOWS\Microsoft.NET\Framework\v*). If you are using another OS or wish to try out Mono (Try Mono), which is a open source .net compiler and run-time environment.

The language is similar to c++ and also Java. The main aspect is that it envolves from class and because of that System is a class which in-turn has the Console sub class and then the method WriteLine.

The helloworld code example

public class helloworld
{
       public static void Main(string[] args)
       {
              System.Console.WriteLine("Hello world!");
       }
}

save as helloworld.cs

To compile with MS .net

csc helloworld.cs

which creates a executable file to execute.
helloworld.exe
with the output

Hello world!

or within mono

mcs helloworld.cs

and then to run the program you can either just type in helloworld.exe as like MS .net or use the JIT (Just In Time) environment, mint.

mint helloworld.exe

Leave a Reply

Your email address will not be published. Required fields are marked *