有没有一种单一的方法或简便的方式可以将一个TDictionary的内容复制到另一个?假设我有以下声明:
我希望能够将源内容完全复制到目标位置。有这样的方法吗?
谢谢!
type
TItemKey = record
ItemID: Integer;
ItemType: Integer;
end;
TItemData = record
Name: string;
Surname: string;
end;
TItems = TDictionary<TItemKey, TItemData>;
var
// the Source and Target have the same types
Source, Target: TItems;
begin
// I can't find the way how to copy source to target
end;
我希望能够将源内容完全复制到目标位置。有这样的方法吗?
谢谢!
var Item: TPair;
...
for Item in ASource do
ATarget.Add(Item.Key, Item.Value);
- TomCat500