Closed delphidabbler closed 2 years ago
On second thoughts I'm not inclined to add these methods because it's so easy to implement creating these data structures in user code.
For example, if GetAll(const List: TList<TPJEnvironmentVar>
was implemented the code to use it would look something like:
var L := Tlist<TPJEnvironmentVar>.Create( { ... } ):
TPJEnvironmentVars.GetAll(L);
{ Do something with L }
L.Free;
Using existing enumerators we achieve the same thing with:
var L := Tlist<TPJEnvironmentVar>.Create( { ... } ):
TPJEnvironmentVars.EnumVars<Integer>(
procedure (const EnvVar: TPJEnvironmentVar; Data: Integer)
begin
L.Add(EnvVar);
end,
0
);
{ Do something with L }
L.Free;
Not too much extra code, I think. And omitting the GetAll
overrides keeps the TPJEnvironmentVars
class a bit cleaner.
Not too much extra code, I think. And omitting the
GetAll
overrides keeps theTPJEnvironmentVars
class a bit cleaner.
And if the proposed new enumerator overloads in issue #17 come to pass, things will be simplified a little by avoiding any parameterisation of the enumerator methods and not needing the dummy Data
parameter.
Decided against adding these methods.
The
TPJEnvironmentVars.GetAll
methods return bothTStrings
andTArray<TPJEnvironmentVar>
types.I'm suggesting the following additional overloads:
GetAll(const List: TList<TPJEnvironmentVar>
)GetAll(const D: TDictionary<string,string>)