• Source
    1. using System;
    2. using System.Collections.Generic;
    3. public interface IHuman { void Speak(); }
    4. public class Japanese : IHuman { public void Speak() { System.Console.WriteLine("私は日本人です。"); } }
    5. public class European : IHuman { public void Speak() { System.Console.WriteLine("I am European."); } }
    6. public class Program
    7. {
    8. public static void Main()
    9. {
    10. List<IHuman> humans = new List<IHuman> { new Japanese(), new European() };
    11. humans.ForEach(x => x.Speak());
    12. }
    13. }
    14.