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
25/07/2009 11:19:31
 
 
À
25/07/2009 11:05:53
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:
01414477
Vues:
35
>Worked for me:
Stack<string> s = new Stack<string>();
>            s.Push("A");
>            s.Push("B");
>            s.Push("C");  // C,B,A
>            s.Reverse();  // A,B,C
>
Hi Viv,

Without the extension method - it won't work
			Stack<string> s = new Stack<string>();
			s.Push("A");
			s.Push("B");
			s.Push("C");  // C,B,A
			s.Reverse();  // A,B,C

			while (s.Count != 0)
			{
				Console.WriteLine(s.Pop());
			}
			Console.ReadLine();  // C, B, A
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform