Skip to content

Instantly share code, notes, and snippets.

@DelphiWorlds
Last active October 20, 2019 08:21
Show Gist options
  • Save DelphiWorlds/ead7496ad10f17bece799a3582a463e4 to your computer and use it in GitHub Desktop.
Save DelphiWorlds/ead7496ad10f17bece799a3582a463e4 to your computer and use it in GitHub Desktop.
StringList value type alternative
type
StringList = TArray<string>;
StringListHelper = record helper for StringList
public
procedure Add(const AValue: string);
end;
{ StringListHelper }
procedure StringListHelper.Add(const AValue: string);
begin
Self := Self + [AValue];
end;
procedure TForm1.FormCreate(Sender: TObject);
var
LStrings: StringList;
begin
LStrings.Add('Test1');
LStrings.Add('Test2');
Memo1.Lines.AddStrings(LStrings);
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment