diff --git a/src/Discord.Net.Core/Entities/Messages/Embed.cs b/src/Discord.Net.Core/Entities/Messages/Embed.cs index ca7431744..ea252cb41 100644 --- a/src/Discord.Net.Core/Entities/Messages/Embed.cs +++ b/src/Discord.Net.Core/Entities/Messages/Embed.cs @@ -102,12 +102,26 @@ namespace Discord public static bool operator !=(Embed left, Embed right) => !(left == right); + /// + /// Determines whether the specified object is equals to the current . + /// + /// + /// If the object passes is an , will be called to compare the 2 instances + /// + /// The object to compare with the current + /// public override bool Equals(object obj) - => obj is not null && GetType() == obj.GetType() && Equals(obj as Embed); + => obj is Embed embed && Equals(embed); + /// + /// Determines whether the specified is equals to the current + /// + /// The to compare with the current + /// public bool Equals(Embed embed) => GetHashCode() == embed.GetHashCode(); + /// public override int GetHashCode() { unchecked diff --git a/src/Discord.Net.Core/Entities/Messages/EmbedAuthor.cs b/src/Discord.Net.Core/Entities/Messages/EmbedAuthor.cs index 340939153..b728c42a0 100644 --- a/src/Discord.Net.Core/Entities/Messages/EmbedAuthor.cs +++ b/src/Discord.Net.Core/Entities/Messages/EmbedAuthor.cs @@ -50,12 +50,26 @@ namespace Discord public static bool operator !=(EmbedAuthor? left, EmbedAuthor? right) => !(left == right); + /// + /// Determines whether the specified object is equals to the current . + /// + /// + /// If the object passes is an , will be called to compare the 2 instances + /// + /// The object to compare with the current + /// public override bool Equals(object obj) - => obj is not null && GetType() == obj.GetType() && Equals(obj as EmbedAuthor?); + => obj is EmbedAuthor embedAuthor && Equals(embedAuthor); + /// + /// Determines whether the specified is equals to the current + /// + /// The to compare with the current + /// public bool Equals(EmbedAuthor embedAuthor) => GetHashCode() == embedAuthor.GetHashCode(); + /// public override int GetHashCode() => (Name, Url, IconUrl).GetHashCode(); } diff --git a/src/Discord.Net.Core/Entities/Messages/EmbedBuilder.cs b/src/Discord.Net.Core/Entities/Messages/EmbedBuilder.cs index 0093842ee..3eb358591 100644 --- a/src/Discord.Net.Core/Entities/Messages/EmbedBuilder.cs +++ b/src/Discord.Net.Core/Entities/Messages/EmbedBuilder.cs @@ -489,9 +489,22 @@ namespace Discord public static bool operator !=(EmbedBuilder left, EmbedBuilder right) => !(left == right); + /// + /// Determines whether the specified object is equals to the current . + /// + /// + /// If the object passes is an , will be called to compare the 2 instances + /// + /// The object to compare with the current + /// public override bool Equals(object obj) - => obj is not null && GetType() == obj.GetType() && Equals(obj as EmbedBuilder); + => obj is EmbedBuilder embedBuilder && Equals(embedBuilder); + /// + /// Determines whether the specified is equals to the current + /// + /// The to compare with the current + /// public bool Equals(EmbedBuilder embedBuilder) { if (Fields.Count != embedBuilder.Fields.Count) @@ -512,6 +525,7 @@ namespace Discord && Url == embedBuilder?.Url; } + /// public override int GetHashCode() => base.GetHashCode(); } @@ -637,14 +651,28 @@ namespace Discord public static bool operator !=(EmbedFieldBuilder left, EmbedFieldBuilder right) => !(left == right); + /// + /// Determines whether the specified object is equals to the current . + /// + /// + /// If the object passes is an , will be called to compare the 2 instances + /// + /// The object to compare with the current + /// public override bool Equals(object obj) - => obj is not null && GetType() == obj.GetType() && Equals(obj as EmbedFieldBuilder); + => obj is EmbedFieldBuilder embedFieldBuilder && Equals(embedFieldBuilder); + /// + /// Determines whether the specified is equals to the current + /// + /// The to compare with the current + /// public bool Equals(EmbedFieldBuilder embedFieldBuilder) => _name == embedFieldBuilder?._name && _value == embedFieldBuilder?._value - && IsInline == embedFieldBuilder?.IsInline; + && IsInline == embedFieldBuilder?.IsInline; + /// public override int GetHashCode() => base.GetHashCode(); } @@ -754,14 +782,28 @@ namespace Discord public static bool operator !=(EmbedAuthorBuilder left, EmbedAuthorBuilder right) => !(left == right); + /// + /// Determines whether the specified object is equals to the current . + /// + /// + /// If the object passes is an , will be called to compare the 2 instances + /// + /// The object to compare with the current + /// public override bool Equals(object obj) - => obj is not null && GetType() == obj.GetType() && Equals(obj as EmbedAuthorBuilder); + => obj is EmbedAuthorBuilder embedAuthorBuilder && Equals(embedAuthorBuilder); + /// + /// Determines whether the specified is equals to the current + /// + /// The to compare with the current + /// public bool Equals(EmbedAuthorBuilder embedAuthorBuilder) => _name == embedAuthorBuilder?._name && Url == embedAuthorBuilder?.Url && IconUrl == embedAuthorBuilder?.IconUrl; + /// public override int GetHashCode() => base.GetHashCode(); } @@ -851,13 +893,27 @@ namespace Discord public static bool operator !=(EmbedFooterBuilder left, EmbedFooterBuilder right) => !(left == right); + /// + /// Determines whether the specified object is equals to the current . + /// + /// + /// If the object passes is an , will be called to compare the 2 instances + /// + /// The object to compare with the current + /// public override bool Equals(object obj) - => obj is not null && GetType() == obj.GetType() && Equals(obj as EmbedFooterBuilder); + => obj is EmbedFooterBuilder embedFooterBuilder && Equals(embedFooterBuilder); + /// + /// Determines whether the specified is equals to the current + /// + /// The to compare with the current + /// public bool Equals(EmbedFooterBuilder embedFooterBuilder) => _text == embedFooterBuilder?._text && IconUrl == embedFooterBuilder?.IconUrl; + /// public override int GetHashCode() => base.GetHashCode(); } } diff --git a/src/Discord.Net.Core/Entities/Messages/EmbedField.cs b/src/Discord.Net.Core/Entities/Messages/EmbedField.cs index c40b61c6d..9c47da9bf 100644 --- a/src/Discord.Net.Core/Entities/Messages/EmbedField.cs +++ b/src/Discord.Net.Core/Entities/Messages/EmbedField.cs @@ -45,12 +45,26 @@ namespace Discord public static bool operator !=(EmbedField? left, EmbedField? right) => !(left == right); + /// + /// Determines whether the specified object is equals to the current . + /// + /// + /// If the object passes is an , will be called to compare the 2 instances + /// + /// The object to compare with the current object + /// public override bool Equals(object obj) - => obj is not null && GetType() == obj.GetType() && Equals(obj as EmbedField?); + => obj is EmbedField embedField && Equals(embedField); + /// + /// Determines whether the specified is equals to the current + /// + /// + /// public bool Equals(EmbedField embedField) => GetHashCode() == embedField.GetHashCode(); + /// public override int GetHashCode() => (Name, Value, Inline).GetHashCode(); } diff --git a/src/Discord.Net.Core/Entities/Messages/EmbedFooter.cs b/src/Discord.Net.Core/Entities/Messages/EmbedFooter.cs index 1c6db2d6d..5311e1890 100644 --- a/src/Discord.Net.Core/Entities/Messages/EmbedFooter.cs +++ b/src/Discord.Net.Core/Entities/Messages/EmbedFooter.cs @@ -52,12 +52,26 @@ namespace Discord public static bool operator !=(EmbedFooter? left, EmbedFooter? right) => !(left == right); + /// + /// Determines whether the specified object is equals to the current . + /// + /// + /// If the object passes is an , will be called to compare the 2 instances + /// + /// The object to compare with the current + /// public override bool Equals(object obj) - => obj is not null && GetType() == obj.GetType() && Equals(obj as EmbedFooter?); + => obj is EmbedFooter embedFooter && Equals(embedFooter); + /// + /// Determines whether the specified is equals to the current + /// + /// The to compare with the current + /// public bool Equals(EmbedFooter embedFooter) => GetHashCode() == embedFooter.GetHashCode(); + /// public override int GetHashCode() => (Text, IconUrl, ProxyUrl).GetHashCode(); } diff --git a/src/Discord.Net.Core/Entities/Messages/EmbedImage.cs b/src/Discord.Net.Core/Entities/Messages/EmbedImage.cs index 6141c9d1d..b1b7488e4 100644 --- a/src/Discord.Net.Core/Entities/Messages/EmbedImage.cs +++ b/src/Discord.Net.Core/Entities/Messages/EmbedImage.cs @@ -62,12 +62,26 @@ namespace Discord public static bool operator !=(EmbedImage? left, EmbedImage? right) => !(left == right); + /// + /// Determines whether the specified object is equals to the current . + /// + /// + /// If the object passes is an , will be called to compare the 2 instances + /// + /// The object to compare with the current + /// public override bool Equals(object obj) - => obj is not null && GetType() == obj.GetType() && Equals(obj as EmbedImage?); + => obj is EmbedImage embedImage && Equals(embedImage); + /// + /// Determines whether the specified is equals to the current + /// + /// The to compare with the current + /// public bool Equals(EmbedImage embedImage) => GetHashCode() == embedImage.GetHashCode(); + /// public override int GetHashCode() => (Height, Width, Url, ProxyUrl).GetHashCode(); } diff --git a/src/Discord.Net.Core/Entities/Messages/EmbedProvider.cs b/src/Discord.Net.Core/Entities/Messages/EmbedProvider.cs index bd8c1c2ec..4252f4845 100644 --- a/src/Discord.Net.Core/Entities/Messages/EmbedProvider.cs +++ b/src/Discord.Net.Core/Entities/Messages/EmbedProvider.cs @@ -44,12 +44,26 @@ namespace Discord public static bool operator !=(EmbedProvider? left, EmbedProvider? right) => !(left == right); + /// + /// Determines whether the specified object is equals to the current . + /// + /// + /// If the object passes is an , will be called to compare the 2 instances + /// + /// The object to compare with the current + /// public override bool Equals(object obj) - => obj is not null && GetType() == obj.GetType() && Equals(obj as EmbedProvider?); + => obj is EmbedProvider embedProvider && Equals(embedProvider); + /// + /// Determines whether the specified is equals to the current + /// + /// The to compare with the current + /// public bool Equals(EmbedProvider embedProvider) => GetHashCode() == embedProvider.GetHashCode(); + /// public override int GetHashCode() => (Name, Url).GetHashCode(); } diff --git a/src/Discord.Net.Core/Entities/Messages/EmbedThumbnail.cs b/src/Discord.Net.Core/Entities/Messages/EmbedThumbnail.cs index 6cac294ad..444d79fb0 100644 --- a/src/Discord.Net.Core/Entities/Messages/EmbedThumbnail.cs +++ b/src/Discord.Net.Core/Entities/Messages/EmbedThumbnail.cs @@ -62,12 +62,26 @@ namespace Discord public static bool operator !=(EmbedThumbnail? left, EmbedThumbnail? right) => !(left == right); + /// + /// Determines whether the specified object is equals to the current . + /// + /// + /// If the object passes is an , will be called to compare the 2 instances + /// + /// The object to compare with the current + /// public override bool Equals(object obj) - => obj is not null && GetType() == obj.GetType() && Equals(obj as EmbedThumbnail?); + => obj is EmbedThumbnail embedThumbnail && Equals(embedThumbnail); + /// + /// Determines whether the specified is equals to the current + /// + /// The to compare with the current + /// public bool Equals(EmbedThumbnail embedThumbnail) => GetHashCode() == embedThumbnail.GetHashCode(); + /// public override int GetHashCode() => (Width, Height, Url, ProxyUrl).GetHashCode(); } diff --git a/src/Discord.Net.Core/Entities/Messages/EmbedVideo.cs b/src/Discord.Net.Core/Entities/Messages/EmbedVideo.cs index fef8a0c49..df0ed4e1f 100644 --- a/src/Discord.Net.Core/Entities/Messages/EmbedVideo.cs +++ b/src/Discord.Net.Core/Entities/Messages/EmbedVideo.cs @@ -56,12 +56,26 @@ namespace Discord public static bool operator !=(EmbedVideo? left, EmbedVideo? right) => !(left == right); + /// + /// Determines whether the specified object is equals to the current . /// + /// + /// + /// If the object passes is an , will be called to compare the 2 instances + /// + /// The object to compare with the current + /// public override bool Equals(object obj) - => obj is not null && GetType() == obj.GetType() && Equals(obj as EmbedVideo?); + => obj is EmbedVideo embedVideo && Equals(embedVideo); + /// + /// Determines whether the specified is equals to the current + /// + /// The to compare with the current + /// public bool Equals(EmbedVideo embedVideo) => GetHashCode() == embedVideo.GetHashCode(); + /// public override int GetHashCode() => (Width, Height, Url).GetHashCode(); }