static bool IsPositive<T>(T[] array) where T : IComparable<T>
foreach (T element in array)
if (0.CompareTo(element) >= 0)
public static void Main()
int[] intArray = { -1, 2, 3, 4, 5};
double[] doubleArray = { 1.1, 2.2, 3.3, 4.4, 5.5};
Console.WriteLine("intArray: {0}", IsPositive<int>(intArray));
Console.WriteLine("doubleArray: {0}", IsPositive<double>(doubleArray));