Last active
August 29, 2015 14:02
-
-
Save Fhernd/f17110371bc005abd114 to your computer and use it in GitHub Desktop.
Demostración del delegado incorporado Action en C#.
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.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