How to break or get out of foreach loop while searching folder for files or something like that

Simple

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] MyNums = { 1, 2, 3, 4, 5 };
            foreach (int i in MyNums)
            {
                if (i == 3) break;
                Console.WriteLine(i);
            }
            Console.ReadKey();
        }
    }
}

This should only print 1 and 2 to the console.