2,497
社区成员
发帖
与我相关
我的任务
分享
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;
procedure Button1Click(Sender: TObject);
private
function GetList: TStrings;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function TForm1.GetList: TStrings;
begin
Result := TStringList.Create;
Result.Add('abc');
Result.Add('def');
Result.Add('ghi');
end;
procedure TForm1.Button1Click(Sender: TObject);
var
ts: TStrings;
begin
ts := GetList;
ShowMessage(ts.Text);
ts.Free;
end;
end.