为什么System.Numerics.BigInteger没有在Silverlight 4.0的解析方法,但确实在.NET 4.0中? [英] Why does System.Numerics.BigInteger not have a Parse method in Silverlight 4.0, but does in .Net 4.0?

查看:124
本文介绍了为什么System.Numerics.BigInteger没有在Silverlight 4.0的解析方法,但确实在.NET 4.0中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到一个奇怪的差异之间的的BigInteger 取值使用的.Net 4.0和Silverlight 4.0;在的BigInteger 有一个解析的TryParse 方法,其中在在的Silverlight 版本,它不具有任一这些

I've come across a weird discrepancy between BigIntegers used by .Net 4.0 and Silverlight 4.0; In .Net, BigInteger has a Parse and TryParse method where as in the Silverlight version, it does not have either of these.

如果你看一下.NET版本 System.Numerics 的反射器,还可以看到,当你拆开code,每一个方法就是一句,它缺乏 BigIntergerBuilder 和朋友的Silverlight的版本:

If you look at the .Net version of System.Numerics in Reflector, you also see that when you disassemble the code, every single method is just empty, and it lacks the BigIntergerBuilder and friends of the Silverlight version:

public static BigInteger Parse(string value)
{
}

什么是怎么回事?

What is going on here?

推荐答案

我不认为System.Numerics.dll是Silverlight的4.0发行版的一部分。但是,这不是真正的问题。你在看什么是基准组件的特殊版本。你会找到一个在 C:\ Program Files文件\引用程序集\微软\框架\ .netframework \ V4.0 例如:

I don't think that System.Numerics.dll is part of the Silverlight 4.0 distribution. But that's not the real point. What you are looking at is a special version of the reference assembly. You'll find one in c:\program files\reference assemblies\microsoft\framework\.netframework\v4.0 for example.

这些组件有他们所有的IL从中剥离。其元数据在其它方面与真正的参考组件的 C:\ WINDOWS \ microsoft.net \框架\ v4.0.30319

The assemblies there have all their IL stripped from them. Their metadata is otherwise identical to the "real" reference assemblies in c:\windows\microsoft.net\framework\v4.0.30319

我不知道是什么,这些剥离组件的功能应该是。我只能想象他们是为了加速编译,因为编译器只需要元数据。但是,这是一个有点远投。我也能想象它是与神秘的新[TargetedPatchingOptOut]属性,一个很长镜头,以及因为它背后没有任何地方解释说,我能找到的机制。我曾与JaredPar交谈关于这一点,他要问里面MSFT一下。有没有听说过了。

I have no clue what the function of these stripped assemblies is supposed to be. I can only imagine they are meant to speed-up compilation, since the compiler only needs the metadata. But that's a bit of a long shot. I can also imagine it has something to do with the mysterious new [TargetedPatchingOptOut] attribute, a very long shot as well since the mechanism behind it isn't explained anywhere that I could find. I had a conversation with JaredPar about this, he was going to ask inside MSFT about it. Haven't heard back.

嗯,没有真正的答案,但它确实说明你看见了什么。

Well, no real answer, but it does explain what you saw.

在此之后,我做多了一个理论,启发,当我注意到,该文件夹名为V4.0。需要注意的是内部版本号是不是它的一部分,因为它是在C:\ WINDOWS \ microsoft.net。这应该有一些有趣的效果,当他们发布新版本,类似于更新的.NET 2.0的基础组件时,服务包被释放。

Following up on this, I do have one more theory, inspired when I noted that the folder is named "v4.0". Note that the build number is not part of it, as it is in c:\windows\microsoft.net. That ought to have interesting effects when they release new builds, similar to the updates to the base assemblies of .NET 2.0 when the service packs were released.

臭名昭著,一件事了严重错误是,这些更新不具有改变的核心类,的 的更改了[的AssemblyVersion。最明显的一次是WaitHandle的类,它收购了WaitOne(INT)的过载。非常有用的,因为谁也想出通过什么样的的 exitContext 的说法。使用这种新的重载是容易做到的,面向.NET 2.0不prevent,但地狱破散,如果目标机器有没有得到服务包安装的原始.NET 2.0 RTM版本。

Infamously, one thing that went badly wrong is that these updates had changes in the core classes, without a change to the [AssemblyVersion]. The most visible one was the WaitHandle class, it acquired the WaitOne(int) overload. Very useful, because nobody could ever figure out what to pass for the exitContext argument. Using this new overload was easy to do, targeting .NET 2.0 doesn't prevent it, but hell breaks loose if the target machine has the original .NET 2.0 RTM release installed without getting the service packs.

我的猜测:这些参考组装方法的内核的组件对.NET 4.0的任何当前和未来的版本。他们的公共接口被冻结。而prevents您意外使用获取以后的版本增加了一个公共方法。由此可见,IL是没有用的,因为这将改变。

My guess: these reference assemblies are the core assemblies for any current and future version of .NET 4.0. Their public interface is frozen. And prevents you from accidentally using a public method that gets added in a later build. It follows that IL isn't useful because that's going to change.

这篇关于为什么System.Numerics.BigInteger没有在Silverlight 4.0的解析方法,但确实在.NET 4.0中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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