Skip to content

Commit

Permalink
Add Enumerator GetEnumerator() for StringLineGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
Akarinnnnn authored Dec 12, 2023
1 parent e78833a commit 65a02e4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Markdig/Helpers/StringLineGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public void Trim()
}
}

private struct Enumerator : IEnumerator
public struct Enumerator : IEnumerator
{
private readonly StringLineGroup _parent;
private int _index;
Expand All @@ -210,12 +210,17 @@ public void Reset()
_index = -1;
}
}

IEnumerator IEnumerable.GetEnumerator()
public Enumerator GetEnumerator()
{
return new Enumerator(this);
}

IEnumerator IEnumerable.GetEnumerator()
{
(IEnumerator)GetEnumerator();
}

private void IncreaseCapacity()
{
var newItems = _pool.Rent(Lines.Length * 2);
Expand Down Expand Up @@ -468,4 +473,4 @@ public LineOffset(int linePosition, int column, int offset, int start, int end)

public readonly int End;
}
}
}

0 comments on commit 65a02e4

Please sign in to comment.