mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-03 06:13:40 +01:00
Better enumerator code
This commit is contained in:
parent
2e7c48316f
commit
1c1b60efee
6 changed files with 46 additions and 34 deletions
|
|
@ -99,7 +99,7 @@ internal sealed partial class AetheryteList
|
|||
|
||||
private struct Enumerator(AetheryteList aetheryteList) : IEnumerator<IAetheryteEntry>
|
||||
{
|
||||
private int index = 0;
|
||||
private int index = -1;
|
||||
|
||||
public IAetheryteEntry Current { get; private set; }
|
||||
|
||||
|
|
@ -107,15 +107,19 @@ internal sealed partial class AetheryteList
|
|||
|
||||
public bool MoveNext()
|
||||
{
|
||||
if (this.index == aetheryteList.Length) return false;
|
||||
this.Current = aetheryteList[this.index];
|
||||
this.index++;
|
||||
return true;
|
||||
if (++this.index < aetheryteList.Length)
|
||||
{
|
||||
this.Current = aetheryteList[this.index];
|
||||
return true;
|
||||
}
|
||||
|
||||
this.Current = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
this.index = 0;
|
||||
this.index = -1;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue