delphi dictionary code example
Example: delphi dictionary example
uses System.Generics.Collections;
procedure TForm1.Button1Click(Sender: TObject);
var
MyDict: TDictionary<string, TForm>;
lEnum : String;
begin
MyDict:= TDictionary<string, TForm>.Create;
try
MyDict.Add('Form1', Self);
lEnum := 'Form1';
//show from key
ShowMessage(MyDict.Items[lEnum].name)
finally
MyDict.Free;
end;
end;