![]() The capacity can be decreased by calling TrimToSize or by setting the Capacity property explicitly. As elements are added to an ArrayList, the capacity is automatically increased as required through reallocation. The capacity of an ArrayList is the number of elements the ArrayList can hold. To maintain a collection that is automatically sorted as new elements are added, you can use the SortedSet class. You must sort the ArrayList by calling its Sort method prior to performing operations (such as BinarySearch) that require the ArrayList to be sorted. The ArrayList is not guaranteed to be sorted. See Non-generic collections shouldn't be used on GitHub for general information on the use of generic instead of non-generic collection types. See Performance Considerations in the List reference topic for a discussion of the relative performance of these classes.
0 Comments
Leave a Reply. |