Last active
August 9, 2024 13:36
-
-
Save DelphiWorlds/ead7496ad10f17bece799a3582a463e4 to your computer and use it in GitHub Desktop.
StringList value type alternative
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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