中国开发网: 论坛: 程序员情感CBD: 贴子 706768
pcplayer
看看 delphi 的 TStringList 的 Help
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.

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录