fix: corrected the sequence properties to handle empty lists
This commit is contained in:
parent
603c692d7f
commit
7fca466dbb
1 changed files with 4 additions and 4 deletions
|
@ -15,15 +15,15 @@ public class EntitySequence
|
|||
this.Index = index;
|
||||
}
|
||||
|
||||
public bool HasNext => !this.IsLast;
|
||||
public bool HasNext => this.Sequence.Count > 0 && !this.IsLast;
|
||||
|
||||
public bool HasPrevious => !this.IsFirst;
|
||||
public bool HasPrevious => this.Sequence.Count > 0 && !this.IsFirst;
|
||||
|
||||
public int Index { get; }
|
||||
|
||||
public bool IsFirst => this.Index == 0;
|
||||
public bool IsFirst => this.Sequence.Count > 0 && this.Index == 0;
|
||||
|
||||
public bool IsLast => this.Index == this.Sequence.Count - 1;
|
||||
public bool IsLast => this.Sequence.Count > 0 && this.Index == this.Sequence.Count - 1;
|
||||
|
||||
public Entity? Next => this.HasNext ? this.Sequence[this.Index + 1] : null;
|
||||
|
||||
|
|
Reference in a new issue