using System; namespace Program { class Foo { public void DoSomething() { Console.WriteLine("Foo"); } } class Bar { public void DoSomething() { Console.WriteLine("Bar"); } } class Program { static void Main(string[] args) { Duck(new Foo()); Duck(new Bar()); } static void Duck(dynamic d) { d.DoSomething(); } } }
Foo Bar
やっぱりテンプレートがほしい