c# - How does IEnumerable<T>.Reverse work? -
I'm looking at the code in the reflector, but I still do not know how to back it behind a collection Can you tell?
Since no calculation is known, and the calculation always starts with the "beginning" of the collection, okay?
Is this a flaw in the .NET framework? Is the cost more than regular calculations?
In short, it buffers everything and then keeps going from the rear side.
In LINQ-to-object, buffering operations (reverse, orderbys, group B, etc.) and non-buffering operations (where, take, IList As an example of non-buffering
reverse
implementation, consider:
> public static IEnumerable & Lt; T & gt; Reverse & Lt; T & gt; (This is iLIT & lt; T & gt; List) {for (ii = List.Count - 1; i> = 0; i--) {yield Return List [i];}}
Note that if you change the list as well If this change is still susceptible to bugs ... so do not do that; -P
Comments
Post a Comment