博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
详测 Generics Collections TList (1): Add、Clear、Count、Capacity
阅读量:7228 次
发布时间:2019-06-29

本文共 832 字,大约阅读时间需要 2 分钟。

  hot3.png

unit Unit1;interfaceuses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,  Dialogs, StdCtrls;type  TForm1 = class(TForm)    Button1: TButton;    procedure Button1Click(Sender: TObject);  end;var  Form1: TForm1;implementation{$R *.dfm}uses Generics.Collections;procedure TForm1.Button1Click(Sender: TObject);var  List: TList
; i: Integer; str: string;begin List := TList
.Create(); {Add} List.Add(22); List.Add(33); List.Add(11); {Count、Capacity} ShowMessageFmt('Count: %d; Capacity: %d', [List.Count, List.Capacity]); str := ''; for i in List do str := str + UIntToStr(i) + sLineBreak; ShowMessage(str); {Clear} List.Clear; ShowMessageFmt('Count: %d; Capacity: %d', [List.Count, List.Capacity]); List.Free;end;end.

转载于:https://my.oschina.net/hermer/blog/320475

你可能感兴趣的文章
tbox中vector容器的使用
查看>>
一个简单的PHP笔试题
查看>>
firebug重新载入页面获取源码
查看>>
我的友情链接
查看>>
5月末周中国.COM总量净增1.2万个 美国净减2.6万个
查看>>
Elasticsearch数据建模-关联查询
查看>>
我的友情链接
查看>>
CentOS 下安装 Lnmp
查看>>
redis系列:通过日志案例学习string命令
查看>>
世界冠军之路:菜鸟车辆路径规划求解引擎研发历程
查看>>
Linux-sendmail
查看>>
关于BSTR的困惑
查看>>
什么时候使用HashMap?它有什么特点?
查看>>
框架名
查看>>
编译安装PHP
查看>>
插入透明背景Flash的HTML代码
查看>>
无标题
查看>>
我的友情链接
查看>>
Web前端入门学习(3)——CSS选择器
查看>>
DNS的搭建
查看>>