.NET (3.5) Framework 类库到底有多大?
我经常读到,该框架对于一个开发人员来说太大了,无法熟悉它的每一部分。掌握一些实际数字肯定有助于正确看待事情。
MSDN 似乎列出了所有这些,但没有实际的数字(据我所知),花几个小时计算它们并不是我认为的生产时间。
- 命名空间的数量
- 类的数量结构的
- 数量
- 接口的数量
我意识到还有委托、枚举、事件等,但上述类型是最有趣的。
此外,基类库 (BCL) 中的类型数量以及整个框架类库 (FCL) 的大小也很有趣。
这些信息有两种用途:
首先,了解您实际使用了整个框架的多少内容以及还有多少内容需要学习。
其次,许多来自其他平台的程序员(以及非技术人员)常常惊讶于程序员可以将大部分时间花在“.NET Framework”上。拥有一些数字肯定有助于解释为什么这并不代表狭隘的技能/经验。
[更新]
使用安德鲁的代码(在我的.NET 3.5 SP1系统上)我得到:
Classes: 12688 Value types: 4438 Interfaces: 1296
I've regularly read that the framework is just too large for one developer to have experience with every part of it. Having some actual numbers would certainly help put things in perspective.
MSDN seems to list them all but there are no actual numbers (from what I could see) and spending hours counting them is not my idea of productive time.
- Number of Namespaces
- Number of Classes
- Number of Structs
- Number of Interfaces
I realize there are also delegates, enums, events, etc, but the above types are of most interest.
Also, the number of types in the Base Class Library (BCL) as well as the size of the overall Framework Class Library (FCL) would be interesting.
This information would be useful in 2 ways:
Firstly, to get a handle on how much of the overall framework you have actually worked with and how much you still have to learn.
Secondly, many programmers from other platforms (and non-technical people) are often surprised that a programmer can spend most of their time within the ".NET Framework". Having some numbers would certainly help explain why this is not an indication of narrow skills/experience.
[Update]
Using Andrew's code (on my .NET 3.5 SP1 system) I get:
Classes: 12688 Value types: 4438 Interfaces: 1296
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
这 2 篇博客文章讨论了该主题:
结果已损坏程序集、命名空间、类型、成员和其他项目的数量减少。
These 2 blog posts address this topic:
Results are broken down by number of assemblies, namespaces, types, members, and other items.
您可以使用反射来查找 BCL 中不同类型的数量,但是您希望利用该信息完成什么任务?
以下是如何获取该信息的示例:
请注意,您需要对框架中的每个程序集执行此操作才能获取总数。
编辑:这是一个快速但肮脏的解决方案,可以让您大致了解 BCL 中的类型数量:
You could use reflection to find the number of different types in the BCL but what are you hoping to accomplish with that information?
Here is an example of how to get that information:
Just note that you will need to do this for every assembly in the framework to get total numbers.
Edit: Here is a quick and dirty solution that should give you a general idea of the number of types in the BCL:
我自己没有使用过它,但我认为这是 NDepend 可以为您提供的信息。
I haven't used it myself, but I think this is the sort of information that NDepend can provide to you.
它是如此之大以至于没有人真正知道它的大小?
就文件大小而言,在我的系统上,2.0、3.0 和 3.5 框架占用大约 130MB 磁盘空间,64 位版本大约占用 93MB。但这还不包括Win7本身的核心内容。
It's so big that noone truly knows its size?
As far as file size goes, on my system the 2.0, 3.0 and 3.5 frameworks take up around 130MB disk space, and the 64 bit versions take roughly 93MB. But that's not counting the stuff that is core to Win7 itself.
如果没有定义“大”的含义,就很难回答——IL (.dll) 大小?源代码大小?功能范围?另外,您是否在谈论最新的 3.5 SP1 可再发行版,没有任何官方附加组件(即 F# 内容、MVC 等),这些附加组件是“框架”的完全支持部分,但不随3.5 可再发行?
我并不是想变得困难……我只是说,有一些变量会影响人们如何确定要测量的内容,然后是一些关于使用哪种棍子来测量它的问题。
It's a bit difficult to answer without having a definition of what 'big' means -- IL (.dll) size? Source code size? Scope of functionality? Also, are you talking about the most recent redistributable of 3.5 SP1 without any of the official add-ons (that is, F# stuff, MVC, etc.) that are fully supported parts of the 'framework' but don't ship with the 3.5 redistributable?
I am not trying to be difficult... I am just saying that there is a few variables that go into how one would even determine what is to be measured, then some questions about what kind of stick is used to measure it.