Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created May 31, 2014 19:47
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/1fa6d12df7c97eee573b to your computer and use it in GitHub Desktop.
Save Fhernd/1fa6d12df7c97eee573b to your computer and use it in GitHub Desktop.
Demostración de delegado personalizado con un parámetro string en C#.
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