// 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();
}
}
Ly8gT3J0aXpPTCAtIHhDU3cKCnVzaW5nIFN5c3RlbTsKdXNpbmcgU3lzdGVtLkR5bmFtaWM7CgpwdWJsaWMgY2xhc3MgQXZpb24gOiBEeW5hbWljT2JqZWN0CnsKICAgIHB1YmxpYyBvdmVycmlkZSBib29sIFRyeUludm9rZU1lbWJlcihJbnZva2VNZW1iZXJCaW5kZXIgYmluZGVyLCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvYmplY3RbXSBhcmdzLCBvdXQgb2JqZWN0IHJlc3VsdCkKICAgIHsKICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiTcOpdG9kbyBgezB9YCBoYSBzaWRvIGludm9jYWRvLiIsIGJpbmRlci5OYW1lKTsKICAgICAgICByZXN1bHQgPSBudWxsOwogICAgICAgIHJldHVybiB0cnVlOwogICAgfQp9CgpwdWJsaWMgY2xhc3MgQXZpb25QcnVlYmEKewogICAgcHVibGljIHN0YXRpYyB2b2lkIE1haW4oKQogICAgewogICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCk7CiAgICAgICAgCiAgICAgICAgZHluYW1pYyBhdmlvbkR5biA9IG5ldyBBdmlvbigpOwogICAgICAgIAogICAgICAgIGF2aW9uRHluLkRlc3BlZ2FyKCk7ICAgIC8vIE3DqXRvZG8gYERlc3BlZ2FyYCBoYSBzaWRvIGludm9jYWRvLgogICAgICAgIGF2aW9uRHluLkF0dGVyaXphcigpOyAgICAvLyBNw6l0b2RvIGBBdGVycml6YXJgIGhhIHNpZG8gaW52b2NhZG8uCiAgICAgICAgCiAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoKTsKICAgIH0KfQ==