Merge pull request #2502 from JustAMan/baseitem-equals

Adds BaseItem.Equals method that compares items by their Id
pull/2449/head^2
Bond-009 5 years ago committed by GitHub
commit 008a76cf4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -33,7 +33,7 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Class BaseItem
/// </summary>
public abstract class BaseItem : IHasProviderIds, IHasLookupInfo<ItemLookupInfo>
public abstract class BaseItem : IHasProviderIds, IHasLookupInfo<ItemLookupInfo>, IEquatable<BaseItem>
{
/// <summary>
/// The supported image extensions
@ -2914,5 +2914,17 @@ namespace MediaBrowser.Controller.Entities
public static readonly IReadOnlyCollection<ExtraType> DisplayExtraTypes = new[] { Model.Entities.ExtraType.BehindTheScenes, Model.Entities.ExtraType.Clip, Model.Entities.ExtraType.DeletedScene, Model.Entities.ExtraType.Interview, Model.Entities.ExtraType.Sample, Model.Entities.ExtraType.Scene };
public virtual bool SupportsExternalTransfer => false;
/// <inheritdoc />
public override bool Equals(object obj)
{
return obj is BaseItem baseItem && this.Equals(baseItem);
}
/// <inheritdoc />
public bool Equals(BaseItem item) => Object.Equals(Id, item?.Id);
/// <inheritdoc />
public override int GetHashCode() => HashCode.Combine(Id);
}
}

Loading…
Cancel
Save