- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
为什么 ImmutableArray Microsoft Immutable Collections NuGet 包版本中似乎没有 1.0.34 ?
最佳答案
ImmutableArray
不存在于您的库版本中。
正如您在 version history 中看到的那样,1.1.20 的发行说明提到“重新包含 ImmutableArray
您可以在 .NET 博客的 1.0 版本中找到关于 ImmutableArray 为何缺失的解释,在此 announcement . (简而言之,当 Roslyn 团队尝试使用该类型而不是常规数组时,他们的性能受到了显着影响,负责该库的团队不确定如何解决该问题,同时保持合理的 API。)
您将在其新的 NuGet 包下找到该库的更新版本, System.Collections.Immutable
.
注意:根据 source code在 System.Collections.Immutable
的新版本中,他们显然已经决定接受 API 攻击——也就是说,对未初始化的 ImmutableArray
进行一些操作。会抛出一个令人惊讶的 NullReferenceException
秒。显然,ImmutableArray
不应该永远被实例化为new
. (应改用 ImmutableArray<T>.Empty
)
关于c# - ImmutableArray 在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29273466/
有什么方法(可能是肮脏的 hack)来创建一个只使用指定数组而不是复制它的 ImmutableArray? 我有一个我知道不会改变的数组,我想创建一个 ImmutableArray 以允许客户端安全地
为什么 ImmutableArray Microsoft Immutable Collections NuGet 包版本中似乎没有 1.0.34 ? 最佳答案 ImmutableArray不存在于您的
我有一个带有静态成员的内部静态类 MyLists: internal static ImmutableArray MyList = new ImmutableArray { "asd", "q
所以我在多线程环境中工作,我不想一直使用 ImmutableArray,因为它是线程安全的。 不幸的是,ImmutableArray 实现线程不安全接口(interface),因此 LINQ 中的 S
我正在尝试对现有的 ImmutableArray 进行切片在一种方法中,我认为我可以使用构造方法 Create(ImmutableArray a, int offset, int count)像这样:
我在 ImmutableArray<> 中遇到了一个看起来很奇怪的错误(使用 BCL 不可变集合 v1.0.12.0,运行时 .NET 4.5): 我在同一命名空间下的同一源文件中有以下两个完全相同的
假设我有如下方法: unsafe void Convert(byte* ptr, int length) { var span = new Span(ptr, length); var
ImmutableArray 之间有什么区别?和 ImmutableList ,最好在哪里使用它们? 最佳答案 以下是一些可能有助于解释的读物:Please welcome ImmutableArra
当我尝试隐式转换时出现此错误: Cannot implicitly convert type 'System.Array' to 'System.Collections.Immutable.Immut
问题 我在两个相应的 dll 中有以下代码。 dll1 依赖于 dll2。 当 DoWork()被调用它将执行 myInterface.MyListMethod(ImmutableList.Empty
我是一名优秀的程序员,十分优秀!