Created
May 31, 2014 19:47
-
-
Save Fhernd/1fa6d12df7c97eee573b to your computer and use it in GitHub Desktop.
Demostración de delegado personalizado con un parámetro string 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.Cap03 | |
{ | |
public delegate void MostrarMensaje(string mensaje); | |
public class SinActionT | |
{ | |
public static void Main() | |
{ | |
MostrarMensaje mm; | |
if (Environment.GetCommandLineArgs().Length > 1) | |
{ | |
mm = MostrarEnVentana; | |
} | |
else | |
{ | |
mm = Console.WriteLine; | |
} | |
mm("Blog xCSw"); | |
} | |
private static void MostrarEnVentana(string mensaje) | |
{ | |
MessageBox.Show(mensaje); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment