Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stack has a reverse method - which does not seem to work
Message
From
23/06/2009 12:15:13
 
 
To
23/06/2009 12:09:30
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 3.0
Miscellaneous
Thread ID:
01407785
Message ID:
01407822
Views:
39
>Reverse() is an extension method and the result of Reverse() is an IEnumerable< int > in your case (it doesn't change the source). It works:
>
>            var result = xx.Reverse(); // should get 3, 2, 1 but still get 1,2,3
>
>
>            Console.WriteLine("Stack");
>
>            foreach(int i in result)
>                Console.Write("{0} ", i);
>            Console.WriteLine();
>
>
>Maybe instead you should use Queue() class for your needs - FIFO?
>
>Cetin


Yes, Cetin - found out about the extension method - see message#1407804

As to the Queue - I know. But there are times when at the end of an operation that has worked with a stack, you need to reverse it
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform