When you want to add or remove data, use lists instead of arrays. Lists grow dynamically and don't need to reserve more space than is needed, whereas resizing arrays is expensive. This is particularly useful when you know what the pattern of growth is going to be, and what your future pattern of access will be.
Wednesday, 20 January 2016
ASP.NET Tips #73 - Use lists instead of arrays when the size is not known in advance
Labels:
ASP.NET
,
Optimization
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment