Skip to content

Commit

Permalink
Fixed the IEnumerable GetEnumerator() method in the Stack<T> class.
Browse files Browse the repository at this point in the history
  • Loading branch information
aalhour committed Jul 30, 2015
1 parent c092bcf commit 9c4028a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion DataStructures/Lists/Stack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ public string ToHumanReadable()

public IEnumerator<T> GetEnumerator ()
{
return _collection.GetEnumerator ();
for(int i = _collection.Count - 1; i >= 0; --i)
yield return _collection[i];
}

System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator ()
Expand Down

0 comments on commit 9c4028a

Please sign in to comment.