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.