The nature of Generic Type Names

time to read 2 min | 227 words

I got a chance today to work with reflection & generics, and I learned some interesting things about generic type names. First, let us look at a generic name:

System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[System.String, mscorlib]], mscorlib

In this case it is a Dictionary<string,string>. You should note several things here.

  • Orange - Before the tick "`", it is a normal type name plus namespace.
  • Pink - The number after the tick is the number of the generic parameters. In this case, we have two.
  • Purple - After the numer, we have [ ], which contains all the full type names of the generic arguments.
  • Green - Inside the [] we have a set of type names, each within its own set of []

In this case, I stripped the culture, public key and version, but you get the idea.