Finished
This commit is contained in:
parent
e487452b18
commit
0e72a5eb05
9 changed files with 146 additions and 57 deletions
|
|
@ -14,26 +14,44 @@ public sealed class NumbersEnumerator : IEnumerator<long>
|
|||
/// <param name="list">List to iterate over</param>
|
||||
public NumbersEnumerator(List<long> list)
|
||||
{
|
||||
// TODO
|
||||
List = null!;
|
||||
List = list;
|
||||
Index = -1;
|
||||
}
|
||||
|
||||
private int Index { get; set; }
|
||||
private List<long> List { get; }
|
||||
|
||||
public long Current => -1L; // TODO
|
||||
|
||||
public void Dispose()
|
||||
public long Current
|
||||
{
|
||||
// TODO?
|
||||
get
|
||||
{
|
||||
if (Index < 0 || Index >= List.Count)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return List[Index];
|
||||
}
|
||||
}
|
||||
|
||||
object IEnumerator.Current => null!; // TODO
|
||||
public void Dispose() { }
|
||||
|
||||
public bool MoveNext() => false; // TODO
|
||||
object IEnumerator.Current => Current;
|
||||
|
||||
public bool MoveNext()
|
||||
{
|
||||
if (Index >= List.Count - 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Index++;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
// TODO
|
||||
Index = -1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue