CSharp – Basic Structure

CSharp or C# is an Object Oriented language and does not offer global variables or functions. Everything is wrapped in classes, even simple types like int and string, which inherits from the System.Object class.
C# could theoretically be compiled to machine code, but in real life, it’s always used in combination with the .NET framework.

Hello World

1. Open Visual Studio> MAIN TOP MENU> File> New Project> Visual C#> Console Application

2. RIGHT COLUMN> Solutions Explorer> click over ‘yourProgram.cs’

3. Write:

// using keyword imports a namespace, and a namespace is a collection of classes.
using System;
using System.Collections.Generic;
using System.Text;

// tutto lo script è contenuto all'interno del namespace con il nome del nostro file
namespace ConsoleApplication1
{
    // we define our class, every line of code that actually does something, is wrapped inside a class.
    class Program
    {
        // Main is the entry-point of our application,  the first piece of code to be executed
        static void Main(string[] args)
        {
            // Console output
            Console.WriteLine("Hello, world!");
            Console.ReadLine();
        }
    }
}

Reference: http://csharp.net-tutorials.com/basics/introduction/