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

Luke B muchomuse at gmail.com
Sat Jan 10 05:38:47 EST 2009


Good read. You got me wondering why type erasure is used. From the Java
site:

Type erasure enables Java applications that use generics to maintain binary
compatibility with Java libraries and applications that were created before
generics.

That might be why it feels more "natural" to me than the .NET stuff, just
because I have a long history with Java. You're probably right on the .NET
system being better in the long run, it was designed at a time when they
could take all the lessons and mistakes of Java into account...

On Fri, Jan 9, 2009 at 8:05 PM, Jonathan Pryor <jonpryor at vt.edu> wrote:

> 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...
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20090110/29cc39c8/attachment.html 


More information about the Mono-list mailing list