Created
October 22, 2017 15:40
-
-
Save Fhernd/449cabd17cc4e8d5fea8b8efef6473e0 to your computer and use it in GitHub Desktop.
Uso de la clase System.Collections.Stack.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
namespace cap07.colecciones | |
{ | |
class TresMaestros | |
{ | |
public static void Main() | |
{ | |
// Creación de un objeto Stack: | |
Stack tresMaestros = new Stack(); | |
tresMaestros.Push("Dostoievskiy"); | |
tresMaestros.Push("Balzac"); | |
tresMaestros.Push("Dickens"); | |
Console.WriteLine("Número de elementos: {0}", tresMaestros.Count); | |
Console.WriteLine("Elementos: "); | |
ImprimirContenido(tresMaestros); | |
} | |
public static void ImprimirContenido(IEnumerable coleccion) | |
{ | |
foreach(Object escritor in coleccion) | |
{ | |
Console.Write(" {0}", escritor); | |
} | |
Console.WriteLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment