2

I have a class:

  public class Person
    {
        public string PersonID { get; set; }
        public string RegistrationNo { get; set; }
        public DateTime RegistrationDate { get; set; }
    }

and i used a List object that will hold number of Person's record mapped from the database in my program. Database has millions of record and I am planning to take all this records at a time and put those record into the List. So my question is the List object capable of holding millions of data at a time or is there any limitation on it?

More specifically what is the limit of List object about holding number of record?

pascalhein
  • 5,700
  • 4
  • 31
  • 44
Rezoan
  • 1,745
  • 22
  • 51
  • 1
    duplicate of [What's the max items in a List?](http://stackoverflow.com/q/2009217) – pascalhein Jun 17 '13 at 13:29
  • 1
    possible duplicate of [What's the max items in a List?](http://stackoverflow.com/questions/2009217/whats-the-max-items-in-a-listt) – Darin Dimitrov Jun 17 '13 at 13:31
  • sorry i first search in google. but no suggestion came out about it. @csharpler – Rezoan Jun 17 '13 at 13:31
  • if this post is helpful to me i will remove my post. – Rezoan Jun 17 '13 at 13:31
  • @Rezoan: [google](https://www.google.de/search?q=list%28of+t%29+maximum+number+of+elements&ie=utf-8&oe=utf-8&aq=t&rls=Palemoon:en-US:official&client=firefox-a&channel=fflb) first result – pascalhein Jun 17 '13 at 13:32
  • @csharpler i search this: http://www.google.com.bd/#q=how+many+data+a+List%3C%3E+object+can+contain+c%23+stackoverflow&client=firefox-a&hs=bia&rls=org.mozilla:en-US:official&biw=1366&bih=624&fp=1&bav=on.2,or.r_qf.&cad=b – Rezoan Jun 17 '13 at 13:39
  • Guys i have got some idea form http://stackoverflow.com/questions/3906891/what-is-the-max-limit-of-data-into-liststring-in-c and http://stackoverflow.com/questions/2009217/whats-the-max-items-in-a-listt . Now should i remove my post or leave it as it is? – Rezoan Jun 17 '13 at 13:57

2 Answers2

3

There is a limit of 2GB for storing objects in memory. You also have a limitation over the amount of items that a collection can handle as other already pointed out.

In any case, I'm pretty sure you don't have to test these limit getting million of records from database unless there is no other option, what is not the case for 99.999% of the cases.

Claudio Redi
  • 67,454
  • 15
  • 130
  • 155
0

It depends mainly on the size of the RAM of the PC and each Object size (In your case it will also depends the size of the RegistrationNo,PersonID etc.).

See the link below to get better Idea.

What's the max items in a List<T>?

Community
  • 1
  • 1
Debajit Mukhopadhyay
  • 4,072
  • 1
  • 17
  • 22