Урок на делфи 81. TStringList (чистка, уничтожение, обнуление)
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
temp1:TStringList;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var i:Integer;
temp2:TStringList;
begin
temp2:=TStringList.Create;
for I := 0 to 10000000 do
temp2.Add('000000000000000000000000000000000000000000000000000000000000000');
temp2.Clear;
end;
procedure TForm1.Button2Click(Sender: TObject);
var i:Integer;
temp2:TStringList;
begin
temp2:=TStringList.Create;
for I := 0 to 10000000 do
temp2.Add('000000000000000000000000000000000000000000000000000000000000000');
temp2.Free;
end;
procedure TForm1.Button3Click(Sender: TObject);
var i:Integer;
temp2:TStringList;
begin
temp2:=TStringList.Create;
for I := 0 to 10000000 do
temp2.Add('000000000000000000000000000000000000000000000000000000000000000');
FreeAndNil(temp2);
end;
procedure TForm1.Button4Click(Sender: TObject);
var i:Integer;
temp2:TStringList;
begin
temp2:=TStringList.Create;
for I := 0 to 10000000 do
temp2.Add('000000000000000000000000000000000000000000000000000000000000000');
temp2.Destroy;
end;
end.