【发布时间】:2018-11-30 06:26:24
【问题描述】:
如何在TDictionary 中使用record?
TMyRec = record
a: Integer;
b: Integer;
end;
...
dictionary = TDictionary<String, TMyRec>.create();
...
dictionary[key].a := 30;<<<
这里编译器给出一个错误:“左侧不能分配给”。如何在不创建单独的函数来编写myFunc(a, b: Integer): TMyRec 的情况下解决此问题?
【问题讨论】:
-
您尝试分配整个
dictionary[key] := someRec;吗?