delphi Using records as key in TDictionary

后端 未结 3 775
春和景丽
春和景丽 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条回答
  •  北恋
    北恋 (楼主)
    2021-02-05 14:04

    My best approach should be to joint the default hash code of the base types.

    For instance:

    Value.App.GetHashCode + Value.ID.GetHashCode + Value.Nr.GetHashCode;
    

提交回复
热议问题