what is the max limit of data into list in c#?

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

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.)

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.

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.

Leave a Comment