public static void ClientCode(AbstractHandler handler) { List <string> ipList = new List <string> { "IPv4/192.168.1.1/Up", "ipv6/fe80::1/Down", "ipv6/fe80::2/Up", "ipv4/172.16.1.1/Up", "ipv5/undefined/Down" }; foreach (var ip in ipList) { var result = handler.Handle(ip); if (result != null) { Console.WriteLine($"{result}"); } else { Console.WriteLine($"{ip} was left untouched."); } } }
public static void ClientCode(AbstractHandler handler) { foreach (var food in new List <string> { "Nut", "Banana", "Cup of coffee" }) { Console.WriteLine($"Client: Who wants a {food}?"); var result = handler.Handle(food); if (result != null) { Console.Write($" {result}"); } else { Console.WriteLine($" {food} was left untouched."); } } }