Answers for "delphi dictionary example"

2

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;
Posted by: Guest on November-11-2020

Browse Popular Code Answers by Language