更新时间:2022-05-10 21:19:20
您不能追加到实际的数组 - 一个数组的大小是固定的创建时间。相反,使用列表< T>
,因为它需要它可以长到
You can't append to an actual array - the size of an array is fixed at creation time. Instead, use a List<T>
which can grow as it needs to.
另外,保持阵列的列表,以及所有将它们连接起来,只有当你已经抓住了一切。
Alternatively, keep a list of arrays, and concatenate them all only when you've grabbed everything.
请参阅Eric利珀特对阵列博客文章的更多细节和见解比我能切实提供:)
See Eric Lippert's blog post on arrays for more detail and insight than I could realistically provide :)