using System.Collections.Generic;
public static void Main()
IEnumerable<int> values = new int[] {-1, 0, 1};
CheckValues(values, IsPositive);
private static bool IsPositive(int input)
private static void CheckValues(IEnumerable<int> values, Predicate<int> predicate)
foreach (int value in values)
bool isPositive = predicate(value);
Console.WriteLine($"{value} {(isPositive ? "is" : "is not")} positive");
private static void CheckValues(IEnumerable<int> values, Func<int, bool> predicate)
foreach (int value in values)
bool isPositive = predicate(value);
Console.WriteLine($"{value} {(isPositive ? "is" : "is not")} positive");