What's the max items in a List?

后端 未结 6 1400
闹比i
闹比i 2020-11-29 08:47

Anybody know what the max number of items in a List is?

How do I increase that size? Or is there a collection that takes infinite items? (as much as would fit in me

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-29 09:37

    The interface defines Count and IndexOf etc as type int so I would assume that int.MaxValue or 2,147,483,647 is the most items you could stick in a list.

    Really got to question why on earth you would need that many, there is likely to be a more sensible approach to managing the data.

提交回复
热议问题