I need a structure similar in operation to TDictionary, but with a few keys. Is there such a thing? Or how best to implement it?
I need a structure similar in operation to TDictionary<>, but with a few keys. Is there such a thing? Or how best to implement it?
I would like to have a dictionary of interfaces, which can be searched by different keys.
e.g:
IHuman = interface
Age : Byte;
Growth : Byte;
UID : Integer;
end;
And I would like to have a list of these interfaces and to be able to search by Age, Growth and UID.
I know that I can do three dictionary:
DictAge : TDictionary;
DictGrowth : TDictionary;
DictUID : TDictionary;
and use as:
function AddHuman(aHuman : IHuman);
begin
DictAge.Add(aHuman.Age, aHuman);
DictGrowth.Add(aHuman.Growth, aHuman);
DictUID.Add(aHuman.UID, aHuman);
end;
but I would prefer something more generic/simple.
Any ideas?
I would like to have a dictionary of interfaces, which can be searched by different keys.
e.g:
IHuman = interface
Age : Byte;
Growth : Byte;
UID : Integer;
end;
And I would like to have a list of these interfaces and to be able to search by Age, Growth and UID.
I know that I can do three dictionary:
DictAge : TDictionary
DictGrowth : TDictionary
DictUID : TDictionary
and use as:
function AddHuman(aHuman : IHuman);
begin
DictAge.Add(aHuman.Age, aHuman);
DictGrowth.Add(aHuman.Growth, aHuman);
DictUID.Add(aHuman.UID, aHuman);
end;
but I would prefer something more generic/simple.
Any ideas?
Comments
Post a Comment