Variables
Implicitly typed variable
Anonymous type
Anonymous types provide a convenient way to encapsulate a set of read-only properties into a single object without having to first explicitly define a type. The type name is generated by the compiler and is not available at the source code level.
var v = new { Amount = 108, Message = "Hello" };
Anonymous types are class types that consist of one or more public read-only properties. No other kinds of class members such as methods or events are allowed. An anonymous type cannot be cast to any interface or type except for object.

Const
A constant expression is an expression that can be fully evaluated at compile time. Therefore, the only possible values for constants of reference types are string and null.
The constant declaration can declare multiple constants, such as:
public const double x = 1.0, y = 2.0, z = 3.0;
(The static modifier is not allowed in a constant declaration.)

Constructors
Static Constructors
Destructors
Properties
private string name;
public string name {
    get { return name; }
    set { name = value;}
}
then foobar.name = "AAA" will call the setter
a = foobar.name will call the getter

Auto-Implemented Properties
Object initializer

Collection Initializers

Readonly
The readonly keyword is a modifier that you can use on fields: assignments to the fields can only occur as part of the declaration or in a constructor in the same class.
The readonly keyword is different from the const keyword. A const field can only be initialized at the declaration of the field. A readonly field can be initialized either at the declaration or in a constructor. Therefore, readonly fields can have different values depending on the constructor used. Also, while a const field is a compile-time constant, the readonly field can be used for run-time constants, as in this line:
public static readonly uint l1 = (uint)DateTime.Now.Ticks;

String literals

Array constants

Delegates
Anonymous methods
Lambda expressions
Nullable Types
Nullable types are instances of the System.Nullable struct. A nullable type can represent the normal range of values for its underlying value type, plus an additional null value. For example, a Nullable<Int32>, pronounced "Nullable of Int32," can be assigned any value from -2147483648 to 2147483647, or it can be assigned the null value. A Nullable<bool> can be assigned the values true or false, or null.
Nullable types represent value-type variables that can be assigned the value of null. You cannot create a nullable type based on a reference type. (Reference types already support the null value.)
The syntax T? is shorthand for System.Nullable<T>, where T is a value type. The two forms are interchangeable.
Use the System.Nullable.GetValueOrDefault property to return either the assigned value, or the default value for the underlying type if the value is null.
Use the HasValue and Value read-only properties to test for null and retrieve the value. The HasValue property returns true if the variable contains a value, or false if it is null. The Value property returns a value if one is assigned, otherwise a System.InvalidOperationException is thrown.
The default value for a nullable type variable sets HasValue to false. The Value is undefined.
Use the ?? (the null-coalescing operator) operator to assign a default value that will be applied when a nullable type whose current value is null is assigned to a non-nullable type
int? x = null; int y = x ?? -1;


Argument by reference
In order to pass argument by reference, use the ref or out both in the method definition and the method call
int i=1;
setVar(ref i);

public void setVar(ref int a)
{
    a=2;
}
With ref, the variable must be initialized before.
With out, the variable may not be initialized before.

Access modifiers

Abstract class and abstract class member

Sealed class and sealed class member

Partial class definition
It is possible to split the definition of a class or a struct, or an interface over two or more source files. Each source file contains a section of the class definition, and all parts are combined when the application is compiled.
public partial class Employee
{
    public void DoWork()
    {
    }
}

public partial class Employee
{
    public void GoToLunch()
    {
    }
}

Deriving a class
class TestBase
{
    private String content;
    public TestBase(string initialValue)
    {
        this.content = initialValue;
    }
}

class TestDerived : TestBase
{
    private int increment;

    public TestDerived(string initialValue, int increment)
        : base(initialValue)
    {
        this.increment = increment;
    }
}

Overriding a method
class TestBase
{

public virtual void dump()
{

}
}

class TestDerived
{

public override void dump()
{

}
}

Base
The base keyword is used to access members of the base class from within a derived class: A base class access is permitted only in a constructor, an instance method, or an instance property accessor. It is an error to use the base keyword from within a static method.

Extension methods
Extension methods enable you to "add" methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type.
namespace ExtensionMethods
{
    public static class MyExtensions
    {
        public static int WordCount(this String str)
        {
            return str.Split(new char[] { ' ', '.', '?' }, StringSplitOptions.RemoveEmptyEntries).Length;
        }
    }
}
using ExtensionMethods;

string s = "Hello Extension Methods";
int i = s.WordCount();

Variable number of parameters
static void Main()
{
    MaFonctionVariable("Bonjour");
    MaFonctionVariable("Bonjour", "Au revoir");
}

static void MaFonctionVariable(params String[] MesParams)
{
    foreach (String courantString in MesParams)
        Console.WriteLine("Valeur du paramètre : {0}", courantString);
}
In order to use parameters of different types, define the parameter as of type Object[].

Unsafe code
The unsafe keyword denotes an unsafe context, which is required for any operation involving pointers.
You can use the unsafe modifier in the declaration of a type, a member, or a code block.

yield
Used in an iterator block to provide a value to the enumerator object or to signal the end of iteration. It takes one of the following forms:
yield return <expression>;
yield break;

throw
The throw statement is used to signal the occurrence of an anomalous situation (exception) during the program execution. It takes the following form throw [expression];, where expression is the exception object. This is omitted when rethrowing the current exception object in a catch clause.

try-catch-finally
A common usage of catch and finally together is to obtain and use resources in a try block, deal with exceptional circumstances in a catch block, and release the resources in the finally block.
using System;
public class EHClass
{
    public static void Main ()
    {
        try
        {
            Console.WriteLine("Executing the try statement.");
            throw new NullReferenceException();
        }
        catch(NullReferenceException e)
        {
            Console.WriteLine("{0} Caught exception #1.", e);
        }
        catch
        {
            Console.WriteLine("Caught exception #2.");
        }
        finally
        {
            Console.WriteLine("Executing finally block.");
        }
    }
}

using
Defines a scope, outside of which an object or objects will be disposed.
using (Font font = new Font("Arial", 10.0f))
{
    // use font
}
or
Font font = new Font("Arial", 10.0f);
using (font)
{
    // use font
}
Multiple objects can be used in with a using statement, but they must be declared inside the using statement, like this:
using (Font font3 = new Font("Arial", 10.0f),
font4 = new Font("Arial", 10.0f))
{
    // Use font3 and font4.
}

Unit tests
Exception
Collections
Predefined delegates (member of System)
Linq
Code contracs
checked/unchecked