I know that number of items you can add to List
in C# is limited by int (because that is the type of count
). Which should be around 2 billion.
But my question is say I want to have such list:
List<MyClass>= new List<MyClass>;
Where
class MyClass
{
string s1; // should be string of 8 characters always
DateTime t;
}
How many objects of MyClass
I can add to the list? I assume
now I have to take into account that the memory
it will occupy is numberOfElements * sizeof(MyClass)
?
So how many elements I can add using such constraint?
(I believe I may run out of memory faster than
I reach max value of int due to formula above, isn't it?).