Chapter.cs Compare Ids for Collection-Comparisons

This commit is contained in:
Glax 2025-05-18 14:05:03 +02:00
parent 4e7a725fee
commit 852fbf5ae8

View File

@ -60,6 +60,9 @@ public class Chapter : IComparable<Chapter>
{ {
if (other is not { } otherChapter) if (other is not { } otherChapter)
throw new ArgumentException($"{other} can not be compared to {this}"); throw new ArgumentException($"{other} can not be compared to {this}");
//Compare Ids for Collection-Comparisons
if(other.ChapterId.Equals(this.ChapterId))
return 0;
return VolumeNumber?.CompareTo(otherChapter.VolumeNumber) switch return VolumeNumber?.CompareTo(otherChapter.VolumeNumber) switch
{ {
< 0 => -1, < 0 => -1,