Export (0) Print
Expand All

SortedList.Capacity Property

Gets or sets the capacity of the SortedList.

[Visual Basic]
Public Overridable Property Capacity As Integer
[C#]
public virtual int Capacity {get; set;}
[C++]
public: __property virtual int get_Capacity();
public: __property virtual void set_Capacity(int);
[JScript]
public function get Capacity() : int;
public function set Capacity(int);

Property Value

The number of elements that the SortedList can contain.

Exceptions

Exception Type Condition
ArgumentOutOfRangeException The value assigned is less than the current number of elements in the SortedList.

Remarks

If the number of elements added to the list reaches the current capacity, the capacity is automatically doubled.

When Capacity is set, the internal arrays are reallocated to accommodate the new capacity.

TrimToSize can also be used to reduce the capacity of the SortedList.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

SortedList Class | SortedList Members | System.Collections Namespace | TrimToSize

Show:
© 2014 Microsoft