You are here: Symbol Reference > Files > StringVar.pas
MtxVec VCL
ContentsIndex
PreviousUpNext
StringVar.pas

Implements StringList, a value type version of the TStringList.

StringList value class is the value type version of the TStringList. You can use the StringList variable without calling the constructor or worrying about freeing the object.Usage Example: 

 

procedure TScriptingForm.Button1Click(Sender: TObject); var strings: StringList; astr: string; begin strings.Add('test1'); strings.Add('test2'); Caption := string(strings); // Caption := strings.Text; RichEdit.Lines.AddStrings(strings); //pointer dereference end; //strings freed here by compiler

 

StringList is the same as TStringList except that it is a value type. It does not have to be created, destroyed or put within try/finally. This is done by the compiler for you. There are virtually no special performance penalties for these to work: 

You can use the same template to make value classes out of your other objects also. This code is free to use.

Name 
Description 
This is namespace StringVar. 
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!