A simple Hello World example

using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("Hello, world!");
    }
}

Running the above example

  1. Open Visual Studio
  2. Create a new C# project, and select console application
  3. Modfy the boilerplate code it provides through the wizard with the code in this example
  4. Compile the execute by using the Build command located on the top menu, or by pressing F7.
  5. If the output from step 4. was successful there will now an executable binary file. The code can be executed from Visual Studio, however since this is a console application without any expected user input the application will close immediately. In my setup the executable HelloWorld.exe was located within the following directory: *c:\users\administrator\documents\visual studio 2015\Projects\HelloWorld\HelloWorld\bin\Debug*
  6. Type ./HelloWorld.exe and observe "Hello, world!" in the output.

Resources