ImmutableArray在哪里? [英] Where is ImmutableArray?

查看:144
本文介绍了ImmutableArray在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么 ImmutableArray 似乎不存在于Microsoft不可变集合NuGet软件包版本

Why does ImmutableArray seem to not be there in Microsoft Immutable Collections NuGet package version 1.0.34?

推荐答案

ImmutableArray在您的库版本中不存在.

ImmutableArray is not present in your version of the library.

您可以在版本历史中看到发行说明对于1.1.20,请提及重新包含的ImmutableArray< T>"

As you can see in the version history, the release notes for 1.1.20 mention "Re-included ImmutableArray<T>"

您可以在此

You can find the explanation for why ImmutableArray was absent from the 1.0 version on the .NET blog, in this announcement. (In short - the Roslyn team had a noticeable performance hit when they tried to use that type instead of regular arrays, and the team in charge of the library was not sure how to fix that, while keeping a reasonable API.)

您将在其新的NuGet包 System.Collections.Immutable <下找到该库的较新版本./a>.

You will find newer versions of the library under its new NuGet package, System.Collections.Immutable.

NB:根据源代码显然已经决定采用该API,也就是说,对统一化的ImmutableArray进行的某些操作将抛出令人惊讶的NullReferenceException s.显然,ImmutableArray绝不应 new实例化. (应改用ImmutableArray<T>.Empty)

N.B.: According to the source code in the new versions of System.Collections.Immutable, they have apparently decided to take the API hit - that is, some operations on a unitialized ImmutableArray will throw a surprising NullReferenceExceptions. Clearly, ImmutableArray should never be instantiated with new. (ImmutableArray<T>.Empty should be used instead)

这篇关于ImmutableArray在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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