fork download
  1. using System;
  2. using System.Dynamic;
  3.  
  4. class Dinamica : DynamicObject {
  5. public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result) {
  6. result = null;
  7. Console.WriteLine($"Executando método \"{binder.Name}\".");
  8. return true;
  9. }
  10. }
  11.  
  12. public class Program {
  13. public static void Main(string[] args) {
  14. dynamic din = new Dinamica();
  15. din.NaoExiste();
  16. }
  17. }
  18.  
  19. //https://pt.stackoverflow.com/q/137542/101
Success #stdin #stdout 0.19s 24252KB
stdin
Standard input is empty
stdout
Executando método "NaoExiste".