Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Stack has a reverse method - which does not seem to work
Message
De
23/06/2009 12:15:13
 
 
À
23/06/2009 12:09:30
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 3.0
Divers
Thread ID:
01407785
Message ID:
01407822
Vues:
40
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform