using System;
namespace Articulos.Cap04
{
internal class Aplicacion
{
public delegate void Delegado(string mensaje);
public static void Metodo(string mensaje)
{
Console.WriteLine(mensaje);
}
public static void MetodoConDelegado(int param1, int param2, Delegado del)
{
del(String.Format("Suma {0}", (param1 + param2).ToString()));
}
public static void Main()
{
Delegado del = new Delegado(Metodo);
MetodoConDelegado(2, 3, del);
}
}
}
dXNpbmcgU3lzdGVtOwoKbmFtZXNwYWNlIEFydGljdWxvcy5DYXAwNAp7CiAgICBpbnRlcm5hbCBjbGFzcyBBcGxpY2FjaW9uCiAgICB7CiAgICAgICAgcHVibGljIGRlbGVnYXRlIHZvaWQgRGVsZWdhZG8oc3RyaW5nIG1lbnNhamUpOwogICAgICAgIAogICAgICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBNZXRvZG8oc3RyaW5nIG1lbnNhamUpCiAgICAgICAgewogICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZShtZW5zYWplKTsKICAgICAgICB9CiAgICAgICAgCiAgICAgICAgcHVibGljIHN0YXRpYyB2b2lkIE1ldG9kb0NvbkRlbGVnYWRvKGludCBwYXJhbTEsIGludCBwYXJhbTIsIERlbGVnYWRvIGRlbCkKICAgICAgICB7CiAgICAgICAgICAgIGRlbChTdHJpbmcuRm9ybWF0KCJTdW1hIHswfSIsIChwYXJhbTEgKyBwYXJhbTIpLlRvU3RyaW5nKCkpKTsKICAgICAgICB9CiAgICAgICAgCiAgICAgICAgcHVibGljIHN0YXRpYyB2b2lkIE1haW4oKQogICAgICAgIHsKICAgICAgICAgICAgRGVsZWdhZG8gZGVsID0gbmV3IERlbGVnYWRvKE1ldG9kbyk7CiAgICAgICAgICAgIAogICAgICAgICAgICBNZXRvZG9Db25EZWxlZ2FkbygyLCAzLCBkZWwpOwogICAgICAgIH0KICAgIH0KfQ==