Advertisement
Fhernd

ConAction.cs

Jul 26th, 2014
828
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.74 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement