PawanS
PawanS

Reputation: 7193

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.

Upvotes: 3

Views: 1125

Answers (2)

James Kovacs
James Kovacs

Reputation: 11661

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

Upvotes: 7

Jens
Jens

Reputation: 25563

A very nice tool for looking at .NET internals is Reflector. It shows the full C# (or VB, or IL) code of many .NET classes, including the collections.

Upvotes: 3

Related Questions