using System;
using System.Collections.Generic;
using System.Linq;
public class Program
{
// Foo() is now generic and expects an IEnumerable, instead of an array
static void Foo<T>(IEnumerable<T> arr)
Console.WriteLine(arr.First());
var next = arr.Skip(1);
if (next.Any()) Foo(next);
}
// but Main() is unchanged: still using an int array
static void Main(string[] args)
int[] myArray = {4,6,78,9,0};
Foo(myArray);