RAD Studio VCL Reference
TStrings.SetCapacity Method

Changes the amount of memory allocated to hold strings in the list.

procedure SetCapacity(NewCapacity: Integer); virtual;
virtual __fastcall SetCapacity(int NewCapacity);

SetCapacity is the protected read implementation of the Capacity property. 

Integer is the number of strings the list can hold after the capacity has changed. 

In TStrings, SetCapacity does nothing. Descendant classes override this method to change the number of strings that the list can hold. For descendant classes that implement SetCapacity, assigning a value smaller than Count removes strings from the end of the list. Assigning a value greater than Count allocates space for more strings to be added. 


Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!