Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How .NET collections and generics works?

I am a trainee software engineer, I did self study on collection and generics and reported to my TL. He suggested me to study these things also.

Specially in generics how memory is defined for generic type, how IL and CLR works for generic?

Performance of generic over collection, or over boxing unboxing?

I googled but getting confined answer. Can please anybody explain or give any matter(Link) on that to study.

Thanks.

like image 851
PawanS Avatar asked Dec 18 '25 05:12

PawanS


1 Answers

Design and Implementation of Generics for the .NET Common Language Runtime by Andrew Kennedy and Don Syme talks about the theory behind implementing generics on the CLR. http://research.microsoft.com/pubs/64031/designandimplementationofgenerics.pdf

The source code is available for the .NET Framework, which allows you to debug through System.Collections.Generic. http://weblogs.asp.net/scottgu/archive/2008/01/16/net-framework-library-source-code-now-available.aspx

If you want deeper information, you can read the Rotor (aka Shared Source Common Language Infrastructure) source code, which is the "source available" part of the .NET Framework. http://www.microsoft.com/downloads/en/details.aspx?FamilyID=8c09fd61-3f26-4555-ae17-3121b4f51d4d&displaylang=en

Another implementation is the Mono project. They have an implementation of generic collections and the Mono codebase is open source. http://www.mono-project.com/Main_Page

like image 180
James Kovacs Avatar answered Dec 20 '25 22:12

James Kovacs