Browse Source

Make IRole inherit IEquatable<IRole>

pull/181/head
Finite Reality 9 years ago
parent
commit
d2d462fe8d
2 changed files with 15 additions and 1 deletions
  1. +1
    -1
      src/Discord.Net/Entities/Roles/IRole.cs
  2. +14
    -0
      src/Discord.Net/Rest/Entities/Roles/Role.cs

+ 1
- 1
src/Discord.Net/Entities/Roles/IRole.cs View File

@@ -5,7 +5,7 @@ using Discord.API.Rest;


namespace Discord namespace Discord
{ {
public interface IRole : IDeletable, ISnowflakeEntity
public interface IRole : IDeletable, ISnowflakeEntity, IEquatable<IRole>
{ {
/// <summary> Gets the color given to users of this role. </summary> /// <summary> Gets the color given to users of this role. </summary>
Color Color { get; } Color Color { get; }


+ 14
- 0
src/Discord.Net/Rest/Entities/Roles/Role.cs View File

@@ -57,6 +57,20 @@ namespace Discord
await Discord.ApiClient.DeleteGuildRoleAsync(Guild.Id, Id).ConfigureAwait(false); await Discord.ApiClient.DeleteGuildRoleAsync(Guild.Id, Id).ConfigureAwait(false);
} }


public override bool Equals(object other)
{
if (other == null) return false;
Role otherAsRole = other as Role;
if (otherAsRole == null) return false;
else return Equals(otherAsRole);
}

public bool Equals(Role other)
{
if (other == null) return false;
else return (Id.Equals(other.Id));
}

public Role Clone() => MemberwiseClone() as Role; public Role Clone() => MemberwiseClone() as Role;
public override string ToString() => Name; public override string ToString() => Name;


Loading…
Cancel
Save