您现在的位置:首页 >> 基础算法 >> window基础 >> 内容

Delphi中释放TStrings Items中的对象

时间:2011/9/3 15:30:13 点击:

  核心提示:procedure FreeObjects(const strings: TStrings) ;varidx : integer;obj : TObject;beginfor idx := 0 to...

procedure FreeObjects(const strings: TStrings) ;
var
  idx : integer;
  obj : TObject;
begin
  for idx := 0 to Pred(strings.Count) do
  begin
    obj := strings.Objects[idx];
    FreeAndNil(obj) ;
  end;
end;
用法示例:

FreeObjects(ComboBox1.Items);
FreeObjects(ListBox1.Items);

作者:网络 来源:转载
共有评论 0相关评论
发表我的评论
  • 大名:
  • 内容:
  • 盒子文章(www.2ccc.com) © 2024 版权所有 All Rights Reserved.
  • 沪ICP备05001939号