泛型如何影响C#和.NET的设计? [英] How did generics influence the design of C# and .NET?

查看:48
本文介绍了泛型如何影响C#和.NET的设计?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个广泛的问题,但这是我不太清楚也很好奇的问题.

我经常听到某些问题的原因,这是因为.NET 1.0中不提供泛型.这让我想到了以下两件事之一:

  1. 之前从未考虑过泛型,因此开发人员在.NET 1.0之后才想到了泛型,这可能会极大地影响C#和.NET的设计,但由于已经做出的决定(向后兼容)而无法实现. p>

  2. 从一开始就一直计划泛型,因此,仅在2.0版之前,才可以使用.NET 1.0释放它,这是唯一的问题.但是除此之外,没有引入多余的功能或错误的操作,做出了不可逆的决定.

我主要假设#1,但实际情况是#2吗?

解决方案

泛型已经存在很长时间了,可以与C ++模板进行比较,尽管概念(可能还有其他语言的实现)早于此. >

.Net 1.0是平台的第一个版本,因此计划是发布合理工作的东西.如果团队中有任何体面的架构师,那么泛型就必须处于计划的未来",但这是可以在以后添加的东西.实际上,关于.NET实现泛型的论文是在.Net Framework 1.0 RTM最终发布之前一年发表的.

时间轴:( http://en.wikipedia.org/wiki/List_of_.NET_Framework_versions)

2002-03-05 .Net Framework version: 1.0.3705.0 released
~May, 2001 Don Syme's paper on "Design and implementation of generics for .NET"

Microsoft可能花了10年的时间来构建.Net Framework 4.0(作为1.0版),但是同时拥有大量的代码和众多的功能,如果该项目发现所有的错误和可用性问题,则需要5年的时间.甚至可以成功.

因此,您的问题的答案将是#2.

Don Syme 主要设计并实现了C#和.Net中的泛型.

资源

Anders Hejlsberg是我的英雄-来自维基百科-Turbo Pascal的原始作者,Delphi的首席架构师,后来的C#首席架构师

This might be a broad question but this is something I am not really clear and very curious.

Often times for certain problems I hear the reasoning that it was because Generics was not available in .NET 1.0. That makes me think either of these 2 things:

  1. Generics was not thought of before, so the developers came up with it after .NET 1.0 which could drastically affect design of C# and .NET but couldn't because of decisions already made (backwards compatibility).

  2. Generics was always planned since the beginning, so the only problem that arise from not releasing it with .NET 1.0 was not being able to use it till 2.0. But other than this, no redundant features were introduced or wrong, irreversible decisions were committed.

I mostly assume #1, but is #2 is the actual case?

解决方案

Generics have been around a long time and can be loosely compared to C++ templates, although the concept (and probably implementation in other languages) predates even that.

.Net 1.0 is the first cut of a platform so the plan was to ship something that works reasonably. Generics would have to have been on the "planned future" if any decent architect was on the team, but is something that could be added later. In fact, the paper on implementing generics for .NET came out a year before .Net Framework 1.0 RTM eventuated.

Timeline: (http://en.wikipedia.org/wiki/List_of_.NET_Framework_versions)

2002-03-05 .Net Framework version: 1.0.3705.0 released
~May, 2001 Don Syme's paper on "Design and implementation of generics for .NET"

Microsoft could have taken 10 years to build .Net Framework 4.0 (as version 1.0), but with so much code and so many features out at once, it would take 5 years to find all the bugs and usability issues if the project can even succeed.

So the answer to your question would be #2.

Don Syme primarily designed and implementated generics into C# and .Net.

Resources

Anders Hejlsberg is my hero - from Wikipedia - original author of Turbo Pascal, the chief architect of Delphi, later lead architect of C#

这篇关于泛型如何影响C#和.NET的设计?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆