CLR 2.0和CLR 4.0之间的区别 [英] Difference between CLR 2.0 and CLR 4.0

查看:71
本文介绍了CLR 2.0和CLR 4.0之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了无数有关C#4.0的新功能的博客,帖子和StackOverflow问题.甚至WPF 4.0的新功能也开始公开发布.我找不到并想知道的内容:

I have read countless blogs, posts and StackOverflow questions about the new features of C# 4.0. Even new WPF 4.0 features have started to come out in the open. What I could not find and will like to know:

  1. 从C#/WPF开发人员的角度来看,CLR 4.0的主要变化是什么?
  2. 整个CLR 4.0有哪些主要变化?

我认为,在内部,大多数更改是针对新的动态语言和并行编程.但是还有其他重大改进吗?因为仅是语言改进,所以语言改进.您只需要新的编译器,并且这些功能可以与版本较低的.Net(1.0/1.1版除外)一起使用(至少可以使用其中的大多数功能).

I think, internally, most changes are for the new dynamic languages and parallel programming. But are there any other major improvements? Because language improvements are just that, language improvements. You just need the new compiler and those features can be used with a lower version of .Net, apart from version 1.0/1.1 (at least most of them can be used).

如果只有上述功能,则仅将这些功能的版本更改为4.0,由于基于.Net 4.0版本(即1.0/1.1、2.0和3.0/之后,我认为是4.0)3.5).版本增量合理吗?

And if the above features are the only ones, only for these features the version is changed to 4.0, which I think is 4.0 because of being based on .Net 4.0 version (i.e. after 1.0/1.1, 2.0 & 3.0/3.5). Is the version increment justified?

正如Pavel Minaev在评论中指出的那样,即使这两个功能也是CLR独立的.在3.0和3.5中也有速度和其他改进.那为什么要增加版本?

As Pavel Minaev pointed out in the comments, even those two features are CLR independent. There were speed and other improvements in 3.0 and 3.5 also. So why the version increment?

推荐答案

我知道的CLR的另一件事是,为了

One new CLR thing that I know about is a form of structural typing for interfaces, structs and delegates for the sake of NoPIA support - basically, it lets runtime treat distinct types with equivalent definitions as if they were the same - so if two assemblies A and B each have a COM-imported interface IFoo declared in them, with the same IID and same members, runtime will treat them as equivalent types; so if there's an instance some class Foo implementing [A]IFoo, you can cast it to [B]IFoo, and the cast will work.

另一件事是能够在单个进程中并排托管多个CLR版本.例如,您不能在一个进程中托管1.x和2.0,但可以托管2.0和4.0.这样做的主要好处是能够同时加载为任一CLR版本编写的插件.

One other thing is the ability to host several CLR versions side-by-side in a single process. You cannot host 1.x and 2.0 in one process, for example, but you can host 2.0 and 4.0. The main benefit for this is the ability to load plugins written for either CLR version concurrently.

一个小小的问题是,像 StackOverflowException 在2.0中一样,一些其他异常也变得不可捕获-例如,您再也无法捕获 AccessViolationException .

One minor bit is that a few more exceptions have become uncatchable like StackOverflowException was in 2.0 - you cannot catch AccessViolationException anymore, for example.

此外,此处是CLR 4.0上的PowerPoint演示文稿来自PDC2008.现在可能有点过时了,但是提到的大多数内容似乎都在beta中.

Also, here is a PowerPoint presentation on CLR 4.0 from PDC 2008. It might be a bit dated now, but most stuff that's mentioned there seems to be in the betas.

这篇关于CLR 2.0和CLR 4.0之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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