refactor: ♻️ use HashCode.Combine for Result hashcode (#2201)

This commit is contained in:
James 2023-06-26 13:51:37 +12:00
parent 7b8f998065
commit 5dd0d349de
No known key found for this signature in database
GPG key ID: C8E452D3682E513C

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Runtime;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -172,16 +173,7 @@ namespace Flow.Launcher.Plugin
/// <inheritdoc /> /// <inheritdoc />
public override int GetHashCode() public override int GetHashCode()
{ {
unchecked return HashCode.Combine(Title, SubTitle, AutoCompleteText, CopyText, IcoPath);
{
// 17 and 23 are prime numbers
int hashcode = 17;
hashcode = hashcode * 23 + (Title?.GetHashCode() ?? 0);
hashcode = hashcode * 23 + (SubTitle?.GetHashCode() ?? 0);
hashcode = hashcode * 23 + (AutoCompleteText?.GetHashCode() ?? 0);
hashcode = hashcode * 23 + (CopyText?.GetHashCode() ?? 0);
return hashcode;
}
} }
/// <inheritdoc /> /// <inheritdoc />