1 using System.Dynamic; 2 public class Duck : DynamicObject 3 { 4 public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result) 5 { 6 Console.WriteLine(binder.Name + " method was called!"); 7 result = null; 8 return true; 9 } 10 } 11 12 static void DynamicDemo() 13 { 14 //The Duck class doesn’t actually have a Quack method.Instead, it uses custom binding to intercept and interpret all method calls. 15 dynamic d = new Duck(); 16 d.Quack(); 17 d.Waddle(); 18 }