Created
May 31, 2014 16:06
-
-
Save Fhernd/d42da3ed9c25b77bf205 to your computer and use it in GitHub Desktop.
Demostración concepto de covarianza en delegados 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; | |
namespace Articulos.Cap04 | |
{ | |
internal delegate object AccionObject(); | |
internal class Aplicacion | |
{ | |
public static void Main() | |
{ | |
// Declaración instancia de `AccionObject`: | |
AccionObject del = new AccionObject(ObtenerString); | |
object resultado = del(); | |
Console.WriteLine("Contenido de `resultado`: {0}", resultado); | |
} | |
public static string ObtenerString() | |
{ | |
return "Blog xCSw"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment