diff --git a/src/ImageSharp/MetaData/Profiles/Exif/ExifValue.cs b/src/ImageSharp/MetaData/Profiles/Exif/ExifValue.cs index ccacfd0bf..c5332788f 100644 --- a/src/ImageSharp/MetaData/Profiles/Exif/ExifValue.cs +++ b/src/ImageSharp/MetaData/Profiles/Exif/ExifValue.cs @@ -198,7 +198,14 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Exif } /// - public override int GetHashCode() => this.GetHashCode(this); + public override int GetHashCode() + { + int hashCode = HashHelpers.Combine(this.Tag.GetHashCode(), this.DataType.GetHashCode()); + + return this.Value != null + ? HashHelpers.Combine(hashCode, this.Value.GetHashCode()) + : hashCode; + } /// public override string ToString() @@ -714,20 +721,5 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Exif throw new NotSupportedException(); } } - - /// - /// Returns the hash code for this instance. - /// - /// - /// The instance of to return the hash code for. - /// - /// - /// A 32-bit signed integer that is the hash code for this instance. - /// - private int GetHashCode(ExifValue exif) - { - int hashCode = exif.Tag.GetHashCode() ^ exif.DataType.GetHashCode(); - return hashCode ^ exif.Value?.GetHashCode() ?? hashCode; - } } } \ No newline at end of file