Follow code review suggestions

This commit is contained in:
Vasily 2020-03-05 14:25:50 +03:00
parent 007c5b9f67
commit 456f571343
1 changed files with 3 additions and 10 deletions

View File

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