Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/f17110371bc005abd114 to your computer and use it in GitHub Desktop.
Save Fhernd/f17110371bc005abd114 to your computer and use it in GitHub Desktop.
Demostración del delegado incorporado Action en C#.
using System;
using System.Windows.Forms;
namespace Articulos.Cap04
{
public class Nombre
{
private string contenido;
public Nombre(string Nombre)
{
this.contenido = Nombre;
}
public void MostarEnConsola()
{
Console.WriteLine(this.contenido);
}
public void MostarEnVentana()
{
MessageBox.Show(this.contenido);
}
}
public class ConAction
{
public static void Main()
{
Nombre nombre = new Nombre("John Ortiz Ordoñez");
// Uso de delegado integrado en BCL:
Action del = nombre.MostarEnVentana;
del();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment