gpt4 book ai didi

c# - ImmutableArray 和 ImmutableList 的区别

转载 作者:IT王子 更新时间:2023-10-29 04:18:32 26 4
gpt4 key购买 nike

ImmutableArray<T> 之间有什么区别?和 ImmutableList<T> ,最好在哪里使用它们?

最佳答案

以下是一些可能有助于解释的读物:Please welcome ImmutableArray

摘录如下:

Reasons to use immutable array:

  • Updating the data is rare or the number of elements is quite small (<16)
  • you need to be able to iterate over the data in performance critical sections
  • you have many instances of immutable collections and you can’t afford keeping the data in trees

Reasons to stick with immutable list:

  • Updating the data is common or the number of elements isn’t expected to be small
  • Updating the collection is more performance critical than iterating the contents

关于c# - ImmutableArray<T> 和 ImmutableList<T> 的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22349861/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com