Follow code review suggestions

This commit is contained in:
Vasily 2020-03-05 14:25:50 +03:00
parent 007c5b9f67
commit 456f571343

View file

@ -2921,24 +2921,17 @@ namespace MediaBrowser.Controller.Entities
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
Logger.LogDebug("Comparing me ({0}) to generic them ({1})", this, obj); return obj is BaseItem baseItem && this.Equals(baseItem);
return this.Equals(obj as BaseItem);
} }
public bool Equals(BaseItem item) public bool Equals(BaseItem item)
{ {
Logger.LogDebug("Comparing me ({0}) to specific them ({1})", this, item); return Object.Equals(Id, item?.Id);
if (item == null)
{
return false;
}
return Id == item.Id;
} }
public override int GetHashCode() public override int GetHashCode()
{ {
return Id.GetHashCode(); return HashCode.Combine(Id);
} }
} }
} }