delphi Using records as key in TDictionary

后端 未结 3 776
春和景丽
春和景丽 2021-02-05 13:38

Can you use a record as a Key value in TDictionary? I want to find objects based on combination of string, integer and integer.

TUserParKey=record
  App:string;
         


        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-05 14:18

    Instead of using the record as a key, you could use a string consisting of the serialized record. You could use something like https://github.com/hgourvest/superobject to do the serialization.

    Since strings have built-in comparison semantics and hashcodes, you don't need to write comparison and hashcode functions.

提交回复
热议问题