pcplayer:
看看 delphi 的 TStringList 的 Help
[阅读: 395] 2009-03-20 17:10:59
ndicates the number of strings the string list has allocated memory to hold.
Delphi syntax:
property Capacity: Integer;
C++ syntax:
__property int Capacity = {read=FCapacity, write=SetCapacity, nodefault};
Description
Use Capacity to find out how much memory is available for holding strings, or to reallocate the memory to allow more or fewer strings.
Capacity is the number of entries in the string list that have been allocated, as opposed to Count, which is the number of strings in the list. Thus, Capacity is always greater than or equal to Count.
Adding new strings will cause the Capacity property to increase if necessary, but setting the Capacity property will not change the Count property. Do not set Capacity to a value less than Count, or the list will be truncated and Count will indicate that the list contains more strings than is the case. Also, if Capacity is set to a value less than Count, the memory used to store the strings that are dropped from the list (as opposed to the entries in the list that point to those strings) is not freed.