Dictionary initialization

Arrays and collections / Dictionaries

uses System.Generics.Collections;

var
  D1, D2: TDictionary<Integer, string>;
begin
  //empty dictionary
  D1 := TDictionary<Integer, string>.Create;

  //init with some data
  D2 := TDictionary<Integer, string>.Create;
  D2.Add(1, 'one');
  D2.Add(2, 'two');

  WriteLn('d1 count is ', D1.Count);
  WriteLn('d2 count is ', D2.Count);
  WriteLn('d2[1] is ', D2[1]);
end.