[Mono-list] How do I reference generic classes in C#???

Jonathan Pryor jonpryor at vt.edu
Fri Jan 9 23:05:36 EST 2009


On Fri, 2009-01-09 at 16:42 -0800, neptune235 wrote:
> Oh, that's totally different than Java, but it seems to work fine. Thanks for
> your help!

That's because Java implements generics through type erasure, so all
generic instantiations use the same (non-generic) type.  .NET generics
are real.

This confers a number of advantages (and a few disadvantages with
respect to generic co- and contra-variance, which C# 4 fixes); see the
Completely Unbiased* article:

	http://www.jprl.com/Blog/archive/development/2007/Aug-31.html

 - Jon

* read: biased, based on my experiences trying to understand Java
generics, then wondering wtf they were thinking...




More information about the Mono-list mailing list