PART II
C h a p t e r 2 4 :
C o l l e c t i o n s , E n u m e r a t o r s , a n d I t e r a t o r s
781
In addition to the properties defined by the interfaces that it implements,
List
adds
Capacity
, shown here:
public int Capacity { get; set; }
Capacity
gets or sets the capacity of the invoking list. The capacity is the number of elements
that can be held before the list must be enlarged. Because a list grows automatically, it is not
necessary to set the capacity manually. However, for efficiency reasons, you might want to
set the capacity when you know in advance how many elements the list will contain. This
prevents the overhead associated with the allocation of more memory.
The following indexer, defined by
Do'stlaringiz bilan baham: |