Generics in C#

Generics in C# have been around for a while (the concept of generics has been around even longer) but there are still a lot of developers who don’t have a good understanding of what they are or how to use them. Looking at the direction C# 4.0 is taking, generics are becoming more and more important and if you don’t make them a natural part of your programming tool belt you are going to find yourself falling behind the curve.

Karl Seguin at has an excellent post that explains generics in a pretty easy to read yet very complete explanation that addresses the reasons he sees for the slow adoption by some developers:

  • The syntax is odd,
  • The problem generics solve isn’t well understood, and
  • How they actually work isn’t clear

You probably deal with generics on a daily basis (using the generic collection classes). If you don’t, you should. Once your understanding of generics grows you can use them in more advanced scenarios but also start using them in your own code.