Created
July 5, 2015 14:15
-
-
Save Fhernd/7c90022823bd13e44cc6 to your computer and use it in GitHub Desktop.
Uso de `DynamicObject` para agregar dinamismo a la clase `Avion`.
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
// OrtizOL - xCSw | |
using System; | |
using System.Dynamic; | |
public class Avion : DynamicObject | |
{ | |
public override bool TryInvokeMember(InvokeMemberBinder binder, | |
object[] args, out object result) | |
{ | |
Console.WriteLine("Método `{0}` ha sido invocado.", binder.Name); | |
result = null; | |
return true; | |
} | |
} | |
public class AvionPrueba | |
{ | |
public static void Main() | |
{ | |
Console.WriteLine(); | |
dynamic avionDyn = new Avion(); | |
avionDyn.Despegar(); // Método `Despegar` ha sido invocado. | |
avionDyn.Atterizar(); // Método `Aterrizar` ha sido invocado. | |
Console.WriteLine(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment