|
|
@@ -1687,10 +1687,10 @@ namespace System.Linq
|
|
|
Check.Source (source);
|
|
|
|
|
|
IList<TSource> list = source as IList<TSource>;
|
|
|
- if (list != null)
|
|
|
- return CreateReverseIterator (list);
|
|
|
+ if (list == null)
|
|
|
+ list = new List<TSource> (source);
|
|
|
|
|
|
- return CreateReverseIterator (source);
|
|
|
+ return CreateReverseIterator (list);
|
|
|
}
|
|
|
|
|
|
static IEnumerable<TSource> CreateReverseIterator<TSource> (IList<TSource> source)
|
|
|
@@ -1699,13 +1699,6 @@ namespace System.Linq
|
|
|
yield return source [i - 1];
|
|
|
}
|
|
|
|
|
|
- static IEnumerable<TSource> CreateReverseIterator<TSource> (IEnumerable<TSource> source)
|
|
|
- {
|
|
|
- var list = new List<TSource> (source);
|
|
|
- list.Reverse ();
|
|
|
- return list;
|
|
|
- }
|
|
|
-
|
|
|
#endregion
|
|
|
|
|
|
#region Select
|