Browse Source

Fixed `GetHashCode()` for `Embed`

pull/2347/head
Misha133 3 years ago
parent
commit
b01d980c98
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      src/Discord.Net.Core/Entities/Messages/Embed.cs

+ 10
- 1
src/Discord.Net.Core/Entities/Messages/Embed.cs View File

@@ -109,6 +109,15 @@ namespace Discord
=> GetHashCode() == embed.GetHashCode();

public override int GetHashCode()
=> (Type, Title, Description, Timestamp, Color, Image, Video, Author, Footer, Provider, Thumbnail, Fields).GetHashCode();
{
unchecked
{
var hash = 17;
hash = hash * 23 + (Type, Title, Description, Timestamp, Color, Image, Video, Author, Footer, Provider, Thumbnail).GetHashCode();
foreach(var field in Fields)
hash = hash * 23 + field.GetHashCode();
return hash;
}
}
}
}

Loading…
Cancel
Save