stack.ToList() in .NET - order of elements?
Posted
by James M.
on Stack Overflow
See other posts from Stack Overflow
or by James M.
Published on 2010-04-13T08:30:10Z
Indexed on
2010/04/13
8:33 UTC
Read the original article
Hit count: 455
When using the .ToList()
extension method on a Stack<T>
, is the result the same as popping each element and adding to a new list (reverse of what was pushed)?
If so, is this because it really is iterating over each element, or does it store the elements in reverse internally and slip the array into a new List<T>
?
© Stack Overflow or respective owner