c# - List<string> Out Of Memory Exception -


i want fill list below :

    list<string> list_lines = new list<string>();     (double num = double.parse(txtstart.text); num < 99999999; num++)     {         list_lines.add(num.tostring());     } 

but codes cause error @ 33,554,432 , error :
out of memory exception
want work list, replacement of or how can fix error?

thanks in advance

if can replace list ienumerable can use following approach

    static ienumerable<string> gen()     {         (double num = 0; num < 99999999; num++)         {             yield return num.tostring();         }     } 

so not allocate memory, further processing have keep in mind cannot call gen().toarray() produce same issue. if need list there no way work.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -