Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. using System;
  2. using System.Windows.Forms;
  3.  
  4. namespace Articulos.Cap04
  5. {
  6.     public class Nombre
  7.     {
  8.         private string contenido;
  9.  
  10.         public Nombre(string Nombre)
  11.         {
  12.             this.contenido = Nombre;
  13.         }
  14.  
  15.         public void MostarEnConsola()
  16.         {
  17.             Console.WriteLine(this.contenido);
  18.         }
  19.  
  20.         public void MostarEnVentana()
  21.         {
  22.             MessageBox.Show(this.contenido);
  23.         }
  24.     }
  25.  
  26.     public class ConAction
  27.     {
  28.         public static void Main()
  29.         {
  30.             Nombre nombre = new Nombre("John Ortiz OrdoƱez");
  31.             // Uso de delegado integrado en BCL:
  32.             Action del = nombre.MostarEnVentana;
  33.             del();
  34.        }
  35.     }
  36. }