简体   繁体   English

.NET集合和泛型如何工作?

[英]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. 我是一名实习软件工程师,我做了关于收集和仿制的自学,并向我的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? 特别是在泛型中如何为泛型类型定义内存,IL和CLR如何用于泛型?

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. 谢谢。

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. 由Andrew Kennedy和Don Syme 设计和实现.NET公共语言运行时的泛型,讨论了在CLR上实现泛型的理论。 http://research.microsoft.com/pubs/64031/designandimplementationofgenerics.pdf 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. 源代码可用于.NET Framework,它允许您通过System.Collections.Generic进行调试。 http://weblogs.asp.net/scottgu/archive/2008/01/16/net-framework-library-source-code-now-available.aspx 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. 如果您需要更深入的信息,可以阅读Rotor(也称为共享源公共语言基础结构)源代码,它是.NET Framework的“可用源代码”部分。 http://www.microsoft.com/downloads/en/details.aspx?FamilyID=8c09fd61-3f26-4555-ae17-3121b4f51d4d&displaylang=en http://www.microsoft.com/downloads/en/details.aspx?FamilyID=8c09fd61-3f26-4555-ae17-3121b4f51d4d&displaylang=en

Another implementation is the Mono project. 另一个实现是Mono项目。 They have an implementation of generic collections and the Mono codebase is open source. 它们具有泛型集合的实现,Mono代码库是开源的。 http://www.mono-project.com/Main_Page http://www.mono-project.com/Main_Page

A very nice tool for looking at .NET internals is Reflector . 一个非常好的工具,用于查看.NET内部是Reflector It shows the full C# (or VB, or IL) code of many .NET classes, including the collections. 它显示了许多.NET类的完整C#(或VB或IL)代码,包括集合。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM