Add



Generics

Generics are used for writing type-safe code. No need to cast or boxing/unboxing. For example,

    public class MyGenericList where T: MyClass
    {
	    ...
    }

We can also use "class" keyword in where.

    public class MyGenericList where T: class
    {
	    ...
    }

Generics Example

Dictionary has key/value pairs. Dictionary is an example of Generics. For example,

    Dictionary intDict = new Dictionary();
    intDict.Add(1,2);

    Dictionary strDict = new Dictionary();
    strDict.Add("First",new MyClass(){...});