Load stack for Reverse using enumerable-taking ctor

This commit is contained in:
Jon Hanna
2017-01-04 14:53:16 +00:00
parent 1829b71255
commit 5bd4521b53
+1 -3
View File
@@ -619,9 +619,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
private static IEnumerable<TSource> ReverseYield<TSource>(IEnumerable<TSource> source)
{
var stack = new Stack<TSource>();
foreach (var item in source)
stack.Push(item);
var stack = new Stack<TSource>(source);
foreach (var item in stack)
yield return item;