数组和集合 / 字典

uses System.Generics.Collections;

var
  D1D2TDictionary<Integerstring>;
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.