public ActionResult EjercicioGenerics()
        {
            //string textoOriginal = "Bella Y Bestia";
            //string textoInvertido = Ejercicios.EjercicioOut.InvertirTexto(textoOriginal);

            EjemploGenerics <ISaludar> ejemploGenerics = new EjemploGenerics <ISaludar>();

            List <ISaludar> animalesQueSaludan = new List <ISaludar>();

            animalesQueSaludan.Add(new Perro()
            {
                Nombre = "Firulais"
            });
            animalesQueSaludan.Add(new Pez()
            {
                Nombre = "Nemo"
            });
            animalesQueSaludan.Add(new Grillo()
            {
                Nombre = "Pepe"
            });
            animalesQueSaludan.Add(new Cerdo()
            {
                Nombre = "Orson"
            });

            string saludoGrupal = ejemploGenerics.SaludarTodos(animalesQueSaludan);

            ViewBag.SaludoGrupal = saludoGrupal;

            return(View());
        }
Example #2
0
        public ActionResult EjercicioGenerics()
        {
            EjemploGenerics <ISaludar> ejemploGenerics = new EjemploGenerics <ISaludar>();

            List <ISaludar> animalesQueSaludan = new List <ISaludar>();

            animalesQueSaludan.Add(new Perro()
            {
                Nombre = "Diogenes"
            });
            animalesQueSaludan.Add(new Gato()
            {
                Nombre = "Macri"
            });
            animalesQueSaludan.Add(new Pez()
            {
                Nombre = "Nemo"
            });

            string saludo = ejemploGenerics.SaludarTodos(animalesQueSaludan);

            ViewBag.SaludoGrupal = saludo;
            return(View());
        }