Language Basics C# Book

Only method, class, interfce, delegate and struct can have type parameters.
Other member can only reference them.

using System;
class Wrapper
{
T t;
T get()
{
return t;
}
void set(T t)
{
this.t = t;
}
}
class Test
{
static void Main()
{
}
}

The following example takes two generic type parameters.

using System;
class Pair
{
TKey key;
TValue value;
TKey getKey()
{
return key;
}
void setKey(TKey key)
{
this.key = key;
}
TValue getValue()
{
return value;
}
void setValue(TValue v)
{
this.value = v;
}
}
class Test
{
static void Main()
{
}
}