Source code: HelloWorld.php

Hello World

A First Step in C# Programming

A computer program is a list of instructions that tell the computer what to do. A program, like any system, can be seen as sequence of
Input → Process → Output

The Hello World program is the common first program used to introduce a programming language, it has the objectives of

  1. Verifying that someone is able to properly run a program
  2. Verifying that a program is able to send output to the user
  3. Verifying that someone is able to enter the source code (program statements) of a program.

C# is more or a compiled program than an interpreted language, which means that C# source programs must be compiled before thay can be executed (run).
See The Mono-Project. Where C# source file is compiled into a byte-code-like structure which is then run through a just-in-time compiler. This is similar to how Java operates.

Creating C# Programs

Most progams will be entered into a file using a text editor, where the programs can be stored, edited as needed, and reused. Create a text file named helloWorld.cs and enter the following program
  using System;  

  class Program  
      static void Main()  { 
        Console.WriteLine("Hello World!");  
        } // end Main  

  } // end Program

Example: With the program saved, The compiler can be invoked to compile HelloWorld.cs into a file main.exe using a command such as :
mcs HelloWorld.cs -out:main.exe

Example: The main program can be executed from a command line such as
mono main.exe
Hello World!

The mcs HelloWorld.cs -out:main.exe command starts the C# compiler, which will read in the input file HelloWorld.cs file and generate file main.exe.
The mono main.exe command will execute the compiled program. the program main.exe program sends the output Hello World! and then terminates.

Note: When using an integrated development environment you will have menus or buttons that will be able to compile and execute your programs. The actual commands that will be used may be hidden from you.