There is an introduction to generics available on MSDN.
One of the simplest examples of using generics is List<T> . This means that if you want to have in your program a collection of something, such as strings, you have a choice:
String[] anArrayOfStrings; System.Collections.ArrayList anArrayListOfObject; List<string> aListOfStrings;
Taking each in turn; anArrayOfStrings is an array of strings. This means that you cannot add to it or remove it. This is normal if you have a fixed number of items. anArrayListOfObject is a .net 1.0 "collection", with the disadvantage that when it takes an object , you can put something there, not just strings.
The final aListOfStrings option aListOfStrings strongly typed in that the compiler will complain about any code that tries to put something into it, is not a string. This makes your code more reliable, readable (you do not need to write code codes to make sure that you insert / delete a string) and are flexible.
source share