var foo = new List<int>(13);
...is not the same as:
var foo = new List<int>(){13};
The first approach is setting a capacity of thirteen for the list, and I basically think this entails setting aside some memory on the heap. The footprint will then not need to grow until a fourteenth item is shoved in. This is not like sizing an array wherein the size cannot change after the new up.
No comments:
Post a Comment