什么是数据导入表1所述的最大限制;串>在C#? [英] what is the max limit of data into list<string> in c#?

查看:171
本文介绍了什么是数据导入表1所述的最大限制;串>在C#?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

多少价值,我可以添加到列表?

How many values I can add to List?

例如:

List<string> Item = runtime data

中的数据是不固定的大小。这可能是10 000或超过1 000 000我用Google搜索,但没有找到一个确切的答案。

The data is not fixed in size. It may be 10 000 or more than 1 000 000. I have Googled but have not found an exact answer.

推荐答案

元素,可以被存储在名单,其中当前执行的最大数量; T&GT; 是,理论上, Int32.MaxValue - 刚刚超过2十亿

The maximum number of elements that can be stored in the current implementation of List<T> is, theoretically, Int32.MaxValue - just over 2 billion.

在目前微软实施的CLR有一个2GB的最大对象大小限制。 (这有可能是其他实现,例​​如单声道,没有这个限制。)

In the current Microsoft implementation of the CLR there's a 2GB maximum object size limit. (It's possible that other implementations, for example Mono, don't have this restriction.)

您特定的列表中包含字符串,这是引用类型。一个参考的尺寸将是4个或8个字节,取决于你使用的是32位还是64位系统上运行。这意味着,实际限制串的数量,你可以存储将大约5.36亿的32位或2.68亿64位。

Your particular list contains strings, which are reference types. The size of a reference will be 4 or 8 bytes, depending on whether you're running on a 32-bit or 64-bit system. This means that the practical limit to the number of strings you could store will be roughly 536 million on 32-bit or 268 million on 64-bit.

在实践中,你最有可能用完分配的内存,你达到这些限制之前,特别是如果你在32位系统上运行。

In practice, you'll most likely run out of allocable memory before you reach those limits, especially if you're running on a 32-bit system.

这篇关于什么是数据导入表1所述的最大限制;串&GT;在C#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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