Possible Duplicate:
Enumerable.Range implementation
I ran into an issue where i need to add a very long value (Int64
) into a list, The value is 600851475143, i want to create a List<Int64>
that contains all the int upto this value, but Enumerable.Range
has a limitation that in the count parameter, it accept only int values, as i am far from that value, i decided to loop through the list and and all those values, but my system soons run out of memory, what should i do?
List<int64> lst = new List<int64>();
for (Int64 i = 3; i < 600851475143; i=i+2)
{
lst.Add(i);
}
Thanks