I'm trying to use a generic dictionary of objects where they key is a string, and the value is a TDictionary. Is this possible? I don't see why not, but I don't know what the syntax would be to add to the dictionary. I've tried a few things but can't quite get it right. Perhaps TPair has to be used somehow.
This code demonstrates what I'm trying to do (it doesn't compile, not enough parameters in AddOrSetValue).
program DictTest;
{$APPTYPE CONSOLE}
uses
SysUtils, Generics.Collections;
type
TLookup = TDictionary<integer, integer>;
TCache = TDictionary<string, TLookup>;
var
Cache : TCache;
begin
Cache := TCache.Create;
try
Cache.AddOrSetValue['Hi', ([1, 2])];
finally
Cache.Free;
end;
end.