using System.Collections.Generic;
public static void Main()
int[] values = GetArray(50, 0, 1000);
int[] matchedItems = values.FindAll(x => x >= lBound && x <= uBound);
for (int ctr = 0; ctr < matchedItems.Length; ctr++)
Console.Write("{0} ", matchedItems[ctr]);
private static int[] GetArray(int n, int lower, int upper)
Random rnd = new Random();
List<int> list = new List<int>();
for (int ctr = 1; ctr <= n; ctr++)
list.Add(rnd.Next(lower, upper + 1));