. :
var repetitions = 100000000
var list = new List<object>();
for (var i = 0; i < repetitions; i++)
list.Add(new object());
, . :
- : 6561, 6394, 6556, 6283, 6466
- : 5951, 6037, 5885, 6044, 5996
- : 6710, 6665, 6729, 6760, 6624
? , ( ).
, , .
Please note that in terms of memory, accurate pre-allocation is the most efficient in terms of memory, as the lack of pre-allocation will increase your list to the minimum required capacity.
source
share