Skip to content

Commit

Permalink
Use HashCode.Combine where applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
Sejsel committed Feb 10, 2021
1 parent 6202b21 commit 08b685d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
10 changes: 2 additions & 8 deletions ArcdpsLogManager/Sections/GameDataGathering.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ public override bool Equals(object obj)

public override int GetHashCode()
{
unchecked
{
return (SpeciesId * 397) ^ (Name != null ? Name.GetHashCode() : 0);
}
return HashCode.Combine(SpeciesId, Name);
}

public static bool operator ==(SpeciesData left, SpeciesData right)
Expand Down Expand Up @@ -91,10 +88,7 @@ public override bool Equals(object obj)

public override int GetHashCode()
{
unchecked
{
return ((int) SkillId * 397) ^ (Name != null ? Name.GetHashCode() : 0);
}
return HashCode.Combine(SkillId, Name);
}

public static bool operator ==(SkillData left, SkillData right)
Expand Down
10 changes: 1 addition & 9 deletions Tests/EVTCAnalytics.LogTests/LogPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,7 @@ public override bool Equals(object obj)

public override int GetHashCode()
{
unchecked
{
int hashCode = (CharacterName != null ? CharacterName.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (AccountName != null ? AccountName.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (int) Profession;
hashCode = (hashCode * 397) ^ (int) EliteSpecialization;
hashCode = (hashCode * 397) ^ Subgroup;
return hashCode;
}
return HashCode.Combine(CharacterName, AccountName, (int) Profession, (int) EliteSpecialization, Subgroup);
}

public static bool operator ==(LogPlayer left, LogPlayer right)
Expand Down

0 comments on commit 08b685d

Please sign in to comment.