uses System.Generics.Collections;
var
D1, D2: TDictionary<Integer, string>;
Pair: TPair<Integer, string>;
begin
D1 := TDictionary<Integer, string>.Create;
D1.Add(1, 'one');
D1.Add(2, 'two');
D1.Add(3, 'tree');
//the constructor copies all pairs
D2 := TDictionary<Integer,
string>.Create(D1);
D2[3] := 'three';
for Pair in D1 do
WriteLn('d1: ', Pair.Key, ' is ',
Pair.Value);
//d1: 1 is one, 2 is two, 3 is tree
for Pair in D2 do
WriteLn('d2: ', Pair.Key, ' is ',
Pair.Value);
//d2: 1 is one, 2 is two, 3 is three
end.